File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -411,6 +411,16 @@ Skipping push. Use --force to override.`,
411411 }
412412
413413 if ( build . status === ACTOR_JOB_STATUSES . SUCCEEDED ) {
414+ // Platform updates `taggedBuilds[buildTag]` asynchronously after the
415+ // build finishes. Wait until the tag points at this build so callers
416+ // that immediately `actor.start({ build: buildTag })` don't race it.
417+ if ( buildTag ) {
418+ while ( Date . now ( ) < deadline ) {
419+ const a = await actorClient . get ( ) ;
420+ if ( a ?. taggedBuilds ?. [ buildTag ] ?. buildId === build . id ) break ;
421+ await new Promise ( ( resolve ) => setTimeout ( resolve , 1000 ) ) ;
422+ }
423+ }
414424 success ( { message : 'Actor was deployed to Apify cloud and built there.' } ) ;
415425 // @ts -expect-error FIX THESE TYPES 😢
416426 } else if ( build . status === ACTOR_JOB_STATUSES . READY ) {
You can’t perform that action at this time.
0 commit comments