This repository was archived by the owner on Apr 8, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -259,10 +259,11 @@ export class GrpcClient extends EventEmitter {
259
259
timeNormalisedRequest ,
260
260
metadata
261
261
)
262
- } catch ( e ) {
263
- this . emit ( MiddlewareSignals . Log . Error , e . message )
262
+ } catch ( error ) {
263
+ this . emit ( MiddlewareSignals . Log . Error , error . message )
264
264
this . emit ( MiddlewareSignals . Event . Error )
265
265
this . setNotReady ( )
266
+ return { error }
266
267
}
267
268
/**
268
269
* Once this gets attached here, it is attached to *all* calls
Original file line number Diff line number Diff line change @@ -385,7 +385,7 @@ export class ZBWorkerBase<
385
385
return
386
386
}
387
387
this . logger . logDebug ( 'Activating Jobs...' )
388
- const jobStream = ( await this . activateJobs ( ) ) as any
388
+ const jobStream = await this . activateJobs ( )
389
389
const id = uuid . v4 ( )
390
390
const start = Date . now ( )
391
391
this . logger . logDebug (
@@ -399,7 +399,7 @@ export class ZBWorkerBase<
399
399
this . jobStreams [ id ] = jobStream . stream
400
400
// This event happens when the server cancels the call after the deadline
401
401
// And when it has completed a response with work
402
- jobStream ! . stream . on ( 'end' , ( ) => {
402
+ jobStream . stream . on ( 'end' , ( ) => {
403
403
this . logger . logDebug (
404
404
`Stream ended after ${ ( Date . now ( ) - start ) / 1000 } seconds`
405
405
)
@@ -417,13 +417,13 @@ export class ZBWorkerBase<
417
417
)
418
418
}
419
419
}
420
- if ( jobStream ! . atCapacity ) {
421
- jobStream ! . atCapacity . once ( CapacityEvent . Available , ( ) =>
420
+ if ( jobStream . atCapacity ) {
421
+ jobStream . atCapacity . once ( CapacityEvent . Available , ( ) =>
422
422
this . longPollLoop ( )
423
423
)
424
424
}
425
- if ( jobStream ! . error ) {
426
- this . logger . logError ( jobStream ! . error . message )
425
+ if ( jobStream . error ) {
426
+ this . logger . logError ( jobStream . error . message )
427
427
setTimeout ( ( ) => this . longPollLoop ( ) , 1000 ) // @TODO implement backoff
428
428
}
429
429
}
You can’t perform that action at this time.
0 commit comments