File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
13
13
type TaskViewWithSchema ,
14
14
} from '../lib/parse' ;
15
15
import { getTaskViewHash } from '../lib/stream' ;
16
+ import { ExhaustiveSwitchCheck } from '../lib/types' ;
16
17
17
18
export class Tasks extends APIResource {
18
19
/**
@@ -148,11 +149,17 @@ export class Tasks extends APIResource {
148
149
yield { event : 'status' , data : res } ;
149
150
}
150
151
151
- if ( res . status === 'finished' ) {
152
- break poll;
152
+ switch ( res . status ) {
153
+ case 'finished' :
154
+ case 'stopped' :
155
+ case 'paused' :
156
+ break poll;
157
+ case 'started' :
158
+ await new Promise ( ( resolve ) => setTimeout ( resolve , config . interval ) ) ;
159
+ break ;
160
+ default :
161
+ throw new ExhaustiveSwitchCheck ( res . status ) ;
153
162
}
154
-
155
- await new Promise ( ( resolve ) => setTimeout ( resolve , config . interval ) ) ;
156
163
} while ( true ) ;
157
164
}
158
165
You can’t perform that action at this time.
0 commit comments