Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add variable polling times based on comp. set #360

Merged
merged 5 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
15 changes: 8 additions & 7 deletions src/commands/force/source/beta/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { FlagsConfig, flags } from '@salesforce/command';
import { flags, FlagsConfig } from '@salesforce/command';
import { Duration } from '@salesforce/kit';
import { Messages } from '@salesforce/core';
import {
FileResponse,
SourceComponent,
ComponentSet,
RetrieveResult,
RequestStatus,
ComponentStatus,
FileResponse,
RequestStatus,
RetrieveResult,
SourceComponent,
} from '@salesforce/source-deploy-retrieve';
import { SourceTracking, throwIfInvalid, replaceRenamedCommands, ChangeResult } from '@salesforce/source-tracking';
import { ChangeResult, replaceRenamedCommands, SourceTracking, throwIfInvalid } from '@salesforce/source-tracking';
import { processConflicts } from '../../../../formatters/conflicts';
import { SourceCommand } from '../../../../sourceCommand';
import { PullResponse, PullResultFormatter } from '../../../../formatters/pullFormatter';

Messages.importMessagesDirectory(__dirname);
const messages: Messages = Messages.loadMessages('@salesforce/plugin-source', 'pull');

Expand Down Expand Up @@ -149,7 +150,7 @@ export default class Pull extends SourceCommand {

// assume: remote deletes that get deleted locally don't fire hooks?
await this.lifecycle.emit('preretrieve', componentSet.toArray());
this.retrieveResult = await mdapiRetrieve.pollStatus(1000, this.getFlag<Duration>('wait').seconds);
this.retrieveResult = await mdapiRetrieve.pollStatus({ timeout: this.getFlag<Duration>('wait') });

// Assume: remote deletes that get deleted locally don't fire hooks.
await this.lifecycle.emit('postretrieve', this.retrieveResult.getFileResponses());
Expand Down
8 changes: 4 additions & 4 deletions src/commands/force/source/beta/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { FlagsConfig, flags } from '@salesforce/command';
import { flags, FlagsConfig } from '@salesforce/command';
import { Duration, env } from '@salesforce/kit';
import { Messages } from '@salesforce/core';
import { RequestStatus, ComponentStatus, DeployResult } from '@salesforce/source-deploy-retrieve';
import { ComponentStatus, DeployResult, RequestStatus } from '@salesforce/source-deploy-retrieve';

import { SourceTracking, throwIfInvalid, replaceRenamedCommands } from '@salesforce/source-tracking';
import { replaceRenamedCommands, SourceTracking, throwIfInvalid } from '@salesforce/source-tracking';
import { getBoolean } from '@salesforce/ts-types';
import { DeployCommand, getVersionMessage } from '../../../../deployCommand';
import { PushResponse, PushResultFormatter } from '../../../../formatters/pushResultFormatter';
Expand Down Expand Up @@ -126,7 +126,7 @@ export default class Push extends DeployCommand {
: new DeployProgressStatusFormatter(this.logger, this.ux);
progressFormatter.progress(deploy);
}
const result = await deploy.pollStatus(500, this.getFlag<Duration>('wait').seconds);
const result = await deploy.pollStatus({ timeout: this.getFlag<Duration>('wait') });

if (result) {
// Only fire the postdeploy event when we have results. I.e., not async.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/force/source/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export class Delete extends DeployCommand {
progressFormatter.progress(deploy);
}

this.deployResult = await deploy.pollStatus(500, this.getFlag<Duration>('wait').seconds);
this.deployResult = await deploy.pollStatus({ timeout: this.getFlag<Duration>('wait') });
await this.lifecycle.emit('postdeploy', this.deployResult);
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/force/source/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class Deploy extends DeployCommand {
: new DeployProgressStatusFormatter(this.logger, this.ux);
progressFormatter.progress(deploy);
}
this.deployResult = await deploy.pollStatus(500, waitDuration.seconds);
this.deployResult = await deploy.pollStatus({ timeout: waitDuration });
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/force/source/deploy/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class Report extends DeployCommand {
: new DeployProgressStatusFormatter(this.logger, this.ux);
progressFormatter.progress(deploy);
}
await deploy.pollStatus(500, waitDuration.seconds);
await deploy.pollStatus({ timeout: waitDuration });
this.deployResult = await this.report(deployId);
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/force/source/retrieve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class Retrieve extends SourceCommand {
});

this.ux.setSpinnerStatus(messages.getMessage('spinnerMessages.polling'));
this.retrieveResult = await mdapiRetrieve.pollStatus(1000, this.getFlag<Duration>('wait').seconds);
this.retrieveResult = await mdapiRetrieve.pollStatus({ timeout: this.getFlag<Duration>('wait') });

await this.lifecycle.emit('postretrieve', this.retrieveResult.getFileResponses());
this.ux.stopSpinner();
Expand Down