Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/commands/actors/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ Skipping push. Use --force to override.`,
run({ message: `Created version ${version} for Actor ${actor.name}.` });
}

// Enable standby mode on existing actors if configured in actor.json
if (!isActorCreatedNow && actorConfig!.usesStandbyMode && !actor.actorStandby?.isEnabled) {
await actorClient.update({ actorStandby: { isEnabled: true } });
info({ message: `Enabled standby mode for Actor ${actor.name}.` });
}
Comment on lines +318 to +322
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this should also support disabling it on push I'd say 😄


// Build Actor on Apify and wait for build to finish
run({ message: `Building Actor ${actor.name}` });
let build = await actorClient.build(version, {
Expand Down
10 changes: 5 additions & 5 deletions test/api/commands/push.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ describe('[api] apify push', () => {
);

it(
'should not enable standby mode on existing actor when usesStandbyMode is true in actor.json',
'should enable standby mode on existing actor when usesStandbyMode is true in actor.json',
async () => {
// Create an actor without standby mode first
const testActorWithTitleDesc = {
Expand All @@ -422,12 +422,12 @@ describe('[api] apify push', () => {
const initialActor = await testActorClient.get();
expect(initialActor?.actorStandby?.isEnabled).to.not.be.eql(true);

// Enable standby
// Enable standby in actor.json
const actorJson = JSON.parse(readFileSync(joinPath(LOCAL_CONFIG_PATH), 'utf8'));
actorJson.usesStandbyMode = true;
writeFileSync(joinPath(LOCAL_CONFIG_PATH), JSON.stringify(actorJson, null, '\t'), { flag: 'w' });

// Push to existing actor - this should update standby mode
// Push to existing actor - this should enable standby mode
await testRunCommand(ActorsPushCommand, {
args_actorId: testActor.id,
flags_noPrompt: true,
Expand All @@ -436,8 +436,8 @@ describe('[api] apify push', () => {

const updatedActor = await testActorClient.get();

// Verify standby is not enabled after push
expect(updatedActor?.actorStandby?.isEnabled).to.not.be.eql(true);
// Verify standby is enabled after push
expect(updatedActor?.actorStandby?.isEnabled).to.be.eql(true);
if (updatedActor) await testActorClient.delete();
},
TEST_TIMEOUT,
Expand Down