File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ class Queue {
55 this . concurrency = concurrency ;
66 this . count = 0 ;
77 this . waiting = [ ] ;
8- this . waitingStart = [ ] ;
98 this . onProcess = null ;
109 this . onDone = null ;
1110 this . onSuccess = null ;
@@ -31,8 +30,7 @@ class Queue {
3130 this . next ( task ) ;
3231 return ;
3332 }
34- this . waiting . push ( task ) ;
35- this . waitingStart . push ( Date . now ( ) ) ;
33+ this . waiting . push ( { task, start : Date . now ( ) } ) ;
3634 }
3735 next ( task ) {
3836 this . count ++ ;
@@ -54,9 +52,8 @@ class Queue {
5452 onProcess ( task , finish ) ;
5553 }
5654 takeNext ( ) {
57- const { waiting, waitingStart, waitTimeout } = this ;
58- const task = waiting . shift ( ) ;
59- const start = waitingStart . shift ( ) ;
55+ const { waiting, waitTimeout } = this ;
56+ const { task, start } = waiting . shift ( ) ;
6057 if ( waitTimeout !== Infinity ) {
6158 const delay = Date . now ( ) - start ;
6259 if ( delay > waitTimeout ) {
You can’t perform that action at this time.
0 commit comments