test: clear plugin cleanup guard timer · openclaw/openclaw@5fe5c64
shakkernerd
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -69,12 +69,19 @@ function expectRouteRegistryState(params: { setup: () => void; assert: () => voi
|
69 | 69 | } |
70 | 70 | |
71 | 71 | async function waitForCleanupSignal(signal: Promise<void>, label: string): Promise<void> { |
72 | | -await Promise.race([ |
73 | | -signal, |
74 | | -new Promise<never>((_, reject) => { |
75 | | -setTimeout(() => reject(new Error(`Timed out waiting for ${label}`)), 500); |
76 | | -}), |
77 | | -]); |
| 72 | +let timer: NodeJS.Timeout | undefined; |
| 73 | +try { |
| 74 | +await Promise.race([ |
| 75 | +signal, |
| 76 | +new Promise<never>((_, reject) => { |
| 77 | +timer = setTimeout(() => reject(new Error(`Timed out waiting for ${label}`)), 500); |
| 78 | +}), |
| 79 | +]); |
| 80 | +} finally { |
| 81 | +if (timer) { |
| 82 | +clearTimeout(timer); |
| 83 | +} |
| 84 | +} |
78 | 85 | } |
79 | 86 | |
80 | 87 | describe("plugin runtime route registry", () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。