Skip to content

Commit

Permalink
Merge pull request #30 from contentstack/fix/DX-488-variant-import
Browse files Browse the repository at this point in the history
Fix import variant errors
  • Loading branch information
aman19K authored May 2, 2024
2 parents 26378cd + 83ec26d commit 7e4f305
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/contentstack-variants/src/import/experiences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export default class Experiences extends PersonalizationAdapter<ImportConfig> {
this.experiencesUidMapper = {};
this.cmsVariantGroups = {};
this.cmsVariants = {};
this.expThresholdTimer = this.experienceConfig?.thresholdTimer ?? 60000;
this.expCheckIntervalDuration = this.experienceConfig?.checkIntervalDuration ?? 10000;
this.expThresholdTimer = this.experienceConfig?.thresholdTimer ?? 30000;
this.expCheckIntervalDuration = this.experienceConfig?.checkIntervalDuration ?? 5000;
this.maxValidateRetry = Math.round(this.expThresholdTimer / this.expCheckIntervalDuration);
this.pendingVariantAndVariantGrpForExperience = [];
this.cTsSuccessPath = resolve(this.config.backupDir, 'mapper', 'content_types', 'success.json');
Expand Down Expand Up @@ -144,14 +144,14 @@ export default class Experiences extends PersonalizationAdapter<ImportConfig> {

if (this.pendingVariantAndVariantGrpForExperience?.length) {
if (retryCount !== this.maxValidateRetry) {
await this.delay(5000);
await this.delay(this.expCheckIntervalDuration);
// Filter out the processed elements
this.pendingVariantAndVariantGrpForExperience = this.pendingVariantAndVariantGrpForExperience.filter(
(uid) => !this.cmsVariants[uid],
);
return this.validateVariantGroupAndVariantsCreated(retryCount);
} else {
this.log(this.config, this.messages.PERSONALIZATION_JOB_FAILURE, 'info');
this.log(this.config, this.messages.PERSONALIZATION_JOB_FAILURE, 'error');
fsUtil.writeFile(this.failedCmsExpPath, this.pendingVariantAndVariantGrpForExperience);
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/contentstack-variants/src/messages/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import memoize from 'lodash/memoize';

const errors = {
CREATE_FAILURE: '${module} created failed!',
CREATE_FAILURE: '{module} created failed!',
};

const commonMsg = {
CREATE_SUCCESS: '${module} created successfully!',
CREATE_SUCCESS: '{module} created successfully!',
};

const migrationMsg = {
IMPORT_MSG: 'Migrating ${module}...',
IMPORT_MSG: 'Migrating {module}...',
};

const variantEntry = {
Expand Down

0 comments on commit 7e4f305

Please sign in to comment.