Skip to content

Commit

Permalink
we should not clear ai task executor timeout, let it tick and it will…
Browse files Browse the repository at this point in the history
… abort
  • Loading branch information
vieiralucas committed Nov 29, 2024
1 parent 63e6097 commit cbf9218
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions apps/api/src/yjs/v2/executor/ai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export class AIExecutor {
private readonly id = uuidv4()
private isRunning = false
private readonly pQueue = new PQueue({ concurrency: 4 })
private timeout: NodeJS.Timeout | null = null

private constructor(
private readonly docId: string,
Expand All @@ -66,10 +65,6 @@ export class AIExecutor {
public async stop(): Promise<void> {
this.isRunning = false

if (this.timeout) {
clearTimeout(this.timeout)
}

await this.pQueue.onIdle()
}

Expand Down Expand Up @@ -141,7 +136,7 @@ export class AIExecutor {
}

if (this.isRunning) {
this.timeout = setTimeout(() => tick(), timeout)
setTimeout(() => tick(), timeout)
}
} catch (err) {
reject(err)
Expand Down

0 comments on commit cbf9218

Please sign in to comment.