-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure abort listeners are removed from queue jobs (#2482)
Fixes a bug where aborted queue jobs were not removing abort signal listeners properly. Also removes the aborted job from the queue immediately to reduce size and allow garbage collection sooner.
- Loading branch information
1 parent
ebb8db8
commit f45dc5d
Showing
5 changed files
with
142 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { TypedEventEmitter } from '@libp2p/interface' | ||
|
||
export interface TestSignalEvents { | ||
abort: CustomEvent | ||
} | ||
|
||
export class TestSignal extends TypedEventEmitter<TestSignalEvents> { | ||
public aborted: boolean | ||
public reason: any | ||
|
||
constructor () { | ||
super() | ||
|
||
this.aborted = false | ||
} | ||
|
||
throwIfAborted (): void { | ||
|
||
} | ||
|
||
onabort (): void { | ||
|
||
} | ||
|
||
abort (reason?: any): void { | ||
this.aborted = true | ||
this.reason = reason | ||
this.safeDispatchEvent('abort') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters