File tree Expand file tree Collapse file tree 4 files changed +14
-4
lines changed
Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 1313 container : " node:${{matrix.node}}"
1414 strategy :
1515 matrix :
16- node : ["16"]
16+ node : ["12", "14", " 16"]
1717 services :
1818 redis-single-instance :
1919 image : redis
Original file line number Diff line number Diff line change 5656 "prepare" : " yarn build" ,
5757 "prepublishOnly" : " yarn install && yarn lint && yarn build && yarn test"
5858 },
59- "dependencies" : {},
59+ "dependencies" : {
60+ "node-abort-controller" : " ^2.0.0"
61+ },
6062 "type" : " module" ,
6163 "exports" : " ./dist/index.js"
6264}
Original file line number Diff line number Diff line change 11import { randomBytes , createHash } from "crypto" ;
22import { EventEmitter } from "events" ;
33
4+ // AbortController became available as a global in node version 16. Once version
5+ // 14 reaches its end-of-life, this can be removed.
6+ import PolyfillAbortController from "node-abort-controller" ;
7+
48import { Redis as IORedisClient } from "ioredis" ;
59type Client = IORedisClient ;
610
@@ -679,7 +683,11 @@ export default class Redlock extends EventEmitter {
679683 // The AbortController/AbortSignal pattern allows the routine to be notified
680684 // of a failure to extend the lock, and subsequent expiration. In the event
681685 // of an abort, the error object will be made available at `signal.error`.
682- const controller = new AbortController ( ) ;
686+ const controller =
687+ typeof AbortController === "undefined"
688+ ? new PolyfillAbortController ( )
689+ : new AbortController ( ) ;
690+
683691 const signal = controller . signal as RedlockAbortSignal ;
684692
685693 function queue ( ) : void {
Original file line number Diff line number Diff line change 11{
22 "compilerOptions" : {
33 "lib" : [" es2020" ],
4- "target" : " es2020 " ,
4+ "target" : " es2018 " ,
55 "module" : " es2020" ,
66 "outDir" : " ./dist" ,
77 "declaration" : true ,
You can’t perform that action at this time.
0 commit comments