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 {
1313 type TaskViewWithSchema ,
1414} from '../lib/parse' ;
1515import { getTaskViewHash } from '../lib/stream' ;
16+ import { ExhaustiveSwitchCheck } from '../lib/types' ;
1617
1718export class Tasks extends APIResource {
1819 /**
@@ -148,11 +149,17 @@ export class Tasks extends APIResource {
148149 yield { event : 'status' , data : res } ;
149150 }
150151
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 ) ;
153162 }
154-
155- await new Promise ( ( resolve ) => setTimeout ( resolve , config . interval ) ) ;
156163 } while ( true ) ;
157164 }
158165
You can’t perform that action at this time.
0 commit comments