Skip to content

Commit

Permalink
fix: add variable polling times based on comp. set (#360)
Browse files Browse the repository at this point in the history
* fix: add variable polling times based on comp. set

* chore: update plugin-source for logic in SDR

* chore: actually remove methods

* chore: cleanup

* chore: bump sdr for polling logic

Co-authored-by: mshanemc <[email protected]>
  • Loading branch information
WillieRuemmele and mshanemc authored Jan 4, 2022
1 parent bc97dcf commit 4a839ff
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@oclif/config": "^1.18.1",
"@salesforce/command": "^4.2.0",
"@salesforce/core": "^2.31.0",
"@salesforce/source-deploy-retrieve": "^5.8.0",
"@salesforce/source-deploy-retrieve": "^5.8.4",
"@salesforce/source-tracking": "^0.5.1",
"chalk": "^4.1.2",
"cli-ux": "^5.6.3",
Expand Down
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
16 changes: 16 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,22 @@
unzipper "0.10.11"
xmldom-sfdx-encoding "^0.1.29"

"@salesforce/source-deploy-retrieve@^5.8.4":
version "5.8.4"
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-5.8.4.tgz#199ea1172095725cb82eb17d1c6ede6645cb0b3c"
integrity sha512-c74auuVpXD3H9aF9KcOwW1C1CinTMbvmCEDOJ90+cgOTQG62lst+Wn4+7iJCDKiH59XoGb9/H/NTKja8g7j3Pg==
dependencies:
"@salesforce/core" "2.31.0"
"@salesforce/kit" "^1.5.0"
"@salesforce/ts-types" "^1.4.2"
archiver "^5.3.0"
fast-xml-parser "^3.17.4"
graceful-fs "^4.2.8"
ignore "^5.1.8"
mime "2.4.6"
unzipper "0.10.11"
xmldom-sfdx-encoding "^0.1.29"

"@salesforce/source-testkit@^0.0.15":
version "0.0.15"
resolved "https://registry.npmjs.org/@salesforce/source-testkit/-/source-testkit-0.0.15.tgz#0587a4cb050cd4f52c292c5aae164f2d09d3f5ee"
Expand Down

0 comments on commit 4a839ff

Please sign in to comment.