@@ -22,23 +22,30 @@ export const QUICK_WATCH_POLL_INTERVAL_MS = 300
2222export type BulkOperation = NonNullable < GetBulkOperationByIdQuery [ 'bulkOperation' ] >
2323
2424export async function shortBulkOperationPoll ( adminSession : AdminSession , operationId : string ) : Promise < BulkOperation > {
25- const startTime = Date . now ( )
26- const poller = pollBulkOperation ( {
27- adminSession,
28- operationId,
29- pollIntervalSeconds : QUICK_WATCH_POLL_INTERVAL_MS / 1000 ,
30- } )
25+ return renderSingleTask < BulkOperation > ( {
26+ title : outputContent `Starting bulk operation...` ,
27+ task : async ( ) => {
28+ const startTime = Date . now ( )
29+ const poller = pollBulkOperation ( {
30+ adminSession,
31+ operationId,
32+ pollIntervalSeconds : QUICK_WATCH_POLL_INTERVAL_MS / 1000 ,
33+ useAdaptivePolling : false ,
34+ } )
3135
32- let latestOperationState : BulkOperation | undefined
36+ let latestOperationState : BulkOperation | undefined
3337
34- do {
35- // eslint-disable-next-line no-await-in-loop
36- const { value, done} = await poller . next ( )
37- latestOperationState = value
38- if ( done ) return latestOperationState
39- } while ( Date . now ( ) - startTime < QUICK_WATCH_TIMEOUT_MS )
38+ do {
39+ // eslint-disable-next-line no-await-in-loop
40+ const { value, done} = await poller . next ( )
41+ latestOperationState = value
42+ if ( done ) return latestOperationState
43+ } while ( Date . now ( ) - startTime < QUICK_WATCH_TIMEOUT_MS )
4044
41- return latestOperationState
45+ return latestOperationState
46+ } ,
47+ renderOptions : { stdout : process . stderr } ,
48+ } )
4249}
4350
4451export async function watchBulkOperation (
0 commit comments