File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -893,17 +893,19 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
893893 }
894894 }
895895
896- // Attach the listener
897- this . messageQueueService . on ( "stateChanged" , queueListener )
898- }
896+ // Attach the listener
897+ this . messageQueueService . on ( "stateChanged" , queueListener )
898+ }
899899
900+ try {
900901 // Wait for askResponse to be set.
901902 await pWaitFor ( ( ) => this . askResponse !== undefined || this . lastMessageTs !== askTs , { interval : 100 } )
902-
903+ } finally {
903904 // Clean up queue listener
904905 if ( queueListener ) {
905906 this . messageQueueService . removeListener ( "stateChanged" , queueListener )
906907 }
908+ }
907909
908910 if ( this . lastMessageTs !== askTs ) {
909911 // Could happen if we send multiple asks in a row i.e. with
You can’t perform that action at this time.
0 commit comments