Skip to content

Commit

Permalink
fix: fetcherPool running forever when no accounts were add to the queue
Browse files Browse the repository at this point in the history
  • Loading branch information
amalcaraz committed Sep 26, 2024
1 parent c62e44e commit bb27273
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/utils/concurrence/pendingWork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,11 @@ export class PendingWorkPool<T> {
const minSleepTimeRef = await concurrentPromises(generator, concurrency)

const sleep = this.skipSleep
? 1
? 0
: minSleepTimeRef.value === MAX_TIMER_INTEGER
? this.options.interval
? this.debouncedJob
? undefined
: this.options.interval
: minSleepTimeRef.value

this.skipSleep = false
Expand Down
2 changes: 2 additions & 0 deletions packages/framework/src/services/fetcher/src/fetcherPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export class FetcherPool<T> extends PendingWorkPool<T> {
})
}

// @note: sleepTime for a fetcher is always between [0, N] never undefined (stop)
// in case it should stop the checkComplete will remove it from the pool
protected async getSleepTime(
fetcher: BaseHistoryFetcher<any>,
): Promise<number> {
Expand Down

0 comments on commit bb27273

Please sign in to comment.