File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ export async function pollQueuedJob<T>({
149
149
}
150
150
151
151
export function isPollError < T > ( r : PollRes < T > ) : r is QueuedJob | Failure {
152
- return isQueuedJobError ( r ) || isFailure ( r ) ;
152
+ return isQueuedJobError ( r ) || isQueuedJobRunning ( r ) || isFailure ( r ) ;
153
153
}
154
154
155
155
export function isBatch ( obj : PollRes < Batch > ) : obj is Batch {
@@ -188,6 +188,11 @@ function isQueuedJobError(obj: any): obj is QueuedJob {
188
188
return isQueuedJob ( obj ) && isStatusError ( obj ) ;
189
189
}
190
190
191
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
192
+ function isQueuedJobRunning ( obj : any ) : obj is QueuedJob {
193
+ return isQueuedJob ( obj ) && isStatusRunning ( obj ) ;
194
+ }
195
+
191
196
function isStatusComplete ( job : QueuedJob ) : boolean {
192
197
return job . data . attributes . status === 'complete' ;
193
198
}
@@ -196,6 +201,10 @@ function isStatusError(job: QueuedJob): boolean {
196
201
return job . data . attributes . status === 'error' ;
197
202
}
198
203
204
+ function isStatusRunning ( job : QueuedJob ) : boolean {
205
+ return job . data . attributes . status === 'running' ;
206
+ }
207
+
199
208
function isClientError < T > ( res : PollRes < T > ) : boolean {
200
209
return isFailure ( res ) && head ( [ ...res . errors . values ( ) ] ) ?. id === ClientErrorId ;
201
210
}
You can’t perform that action at this time.
0 commit comments