Skip to content

Commit ecef199

Browse files
committed
v3: Use global setTimeout to ensure cross-runtime support
1 parent 4acfb8f commit ecef199

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.changeset/polite-pears-grow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
---
4+
5+
Use global setTimeout to ensure cross-runtime support

packages/trigger-sdk/src/v3/runs.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
RetrieveRunResponse,
99
apiClientManager,
1010
} from "@trigger.dev/core/v3";
11-
import { setTimeout } from "timers/promises";
1211
import { Prettify, RunHandle, apiClientMissingError } from "./shared";
1312

1413
export type RetrieveRunResult<TOutput> = Prettify<
@@ -98,6 +97,6 @@ async function poll<TRunHandle extends RunHandle<any> | string>(
9897
return run;
9998
}
10099

101-
await setTimeout(Math.max(options?.pollIntervalMs ?? 5000, 1000));
100+
await new Promise((resolve) => setTimeout(resolve, options?.pollIntervalMs ?? 1000));
102101
}
103102
}

0 commit comments

Comments
 (0)