Skip to content

Commit

Permalink
chore: further increase long running task duration
Browse files Browse the repository at this point in the history
  • Loading branch information
jedlikowski committed Sep 30, 2024
1 parent 98c2966 commit b66f1a5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/fn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,17 @@ test('timeout', async () => {

test('subsequent executions after timeout', async () => {
const executionTimeout = 30
const longRunningTaskDuration = executionTimeout * 10
process.env.SYNCKIT_TIMEOUT = executionTimeout.toString()

const { createSyncFn } = await import('synckit')
const syncFn = createSyncFn<AsyncWorkerFn>(workerCjsPath)

// start an execution in worker that will definitely time out
expect(() => syncFn(1, executionTimeout * 3)).toThrow()
expect(() => syncFn(1, longRunningTaskDuration)).toThrow()

// wait for timed out execution to finish inside worker
await new Promise(resolve => setTimeout(resolve, executionTimeout * 3))
await new Promise(resolve => setTimeout(resolve, longRunningTaskDuration))

// subsequent executions should work correctly
expect(syncFn(2, 1)).toBe(2)
Expand Down

0 comments on commit b66f1a5

Please sign in to comment.