File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @tus/server ' : minor
3+ ---
4+
5+ Add ` lockDrainTimeout ` option
Original file line number Diff line number Diff line change @@ -92,6 +92,10 @@ export class Server extends EventEmitter {
9292 options . locker = new MemoryLocker ( )
9393 }
9494
95+ if ( ! options . lockDrainTimeout ) {
96+ options . lockDrainTimeout = 3000
97+ }
98+
9599 const { datastore, ...rest } = options
96100 this . options = rest as ServerOptions
97101 this . datastore = datastore
@@ -288,7 +292,7 @@ export class Server extends EventEmitter {
288292 abortWithDelayController . signal . removeEventListener ( 'abort' , onDelayedAbort )
289293 setTimeout ( ( ) => {
290294 requestAbortController . abort ( err )
291- } , 3000 )
295+ } , this . options . lockDrainTimeout )
292296 }
293297 abortWithDelayController . signal . addEventListener ( 'abort' , onDelayedAbort )
294298
Original file line number Diff line number Diff line change @@ -71,6 +71,11 @@ export type ServerOptions = {
7171 | Promise < Locker >
7272 | ( ( req : http . IncomingMessage ) => Locker | Promise < Locker > )
7373
74+ /**
75+ * This timeout controls how long the server will wait a cancelled lock to do its cleanup.
76+ */
77+ lockDrainTimeout ?: number
78+
7479 /**
7580 * Disallow termination for finished uploads.
7681 */
You can’t perform that action at this time.
0 commit comments