File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
packages/client/lib/sync/fetcher Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 20
20
runs-on : ubuntu-latest
21
21
strategy :
22
22
matrix :
23
- node-version : [12]
23
+ node-version : [12,14 ]
24
24
steps :
25
25
- name : Use Node.js ${{ matrix.node-version }}
26
26
uses : actions/setup-node@v1
Original file line number Diff line number Diff line change @@ -45,7 +45,8 @@ export class Fetcher extends Readable {
45
45
protected in : any
46
46
protected out : any
47
47
protected total : number
48
- protected processed : number
48
+ protected processed : number // number of processed tasks, awaiting the write job
49
+ protected finished : number // number of tasks which are both processed and also finished writing
49
50
protected running : boolean
50
51
protected reading : boolean
51
52
private _readableState : any
@@ -69,6 +70,7 @@ export class Fetcher extends Readable {
69
70
this . out = new Heap ( { comparBefore : ( a : any , b : any ) => a . index < b . index } )
70
71
this . total = 0
71
72
this . processed = 0
73
+ this . finished = 0
72
74
this . running = false
73
75
this . reading = false
74
76
}
@@ -212,6 +214,7 @@ export class Fetcher extends Readable {
212
214
const _write = async ( result : any , encoding : any , cb : Function ) => {
213
215
try {
214
216
await this . store ( result )
217
+ this . finished ++
215
218
this . emit ( 'fetched' , result )
216
219
cb ( )
217
220
} catch ( error ) {
@@ -262,7 +265,7 @@ export class Fetcher extends Readable {
262
265
this . running = true
263
266
while ( this . running ) {
264
267
if ( ! this . next ( ) ) {
265
- if ( this . processed === this . total ) {
268
+ if ( this . finished === this . total ) {
266
269
this . push ( null )
267
270
}
268
271
await this . wait ( )
You can’t perform that action at this time.
0 commit comments