Skip to content

Commit

Permalink
fix(api): deploying sync now keeps frequency override (#1556)
Browse files Browse the repository at this point in the history
  • Loading branch information
bodinsamuel authored Jan 29, 2024
1 parent 6a2e198 commit 8c8932f
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions packages/shared/lib/services/sync/config/deploy.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,20 @@ export async function deployPreBuilt(
if (previousSyncAndActionConfig) {
bumpedVersion = increment(previousSyncAndActionConfig.version as string | number).toString();

const syncs = await getSyncsByProviderConfigAndSyncName(environment_id, provider_config_key, sync_name);
for (const sync of syncs) {
if (!runs) {
continue;
}
const { success, error } = await updateSyncScheduleFrequency(sync.id as string, runs, sync_name, environment_id, activityLogId as number);

if (!success) {
return { success, error, response: null };
if (runs) {
const syncsConfig = await getSyncsByProviderConfigAndSyncName(environment_id, provider_config_key, sync_name);
for (const syncConfig of syncsConfig) {
const { success, error } = await updateSyncScheduleFrequency(
syncConfig.id as string,
syncConfig?.frequency || runs,
sync_name,
environment_id,
activityLogId as number
);

if (!success) {
return { success, error, response: null };
}
}
}
}
Expand Down Expand Up @@ -563,15 +568,21 @@ async function compileDeployInfo(
});
}

const syncs = await getSyncsByProviderConfigAndSyncName(environment_id, providerConfigKey, syncName);
for (const sync of syncs) {
if (!runs) {
continue;
}
const { success, error } = await updateSyncScheduleFrequency(sync.id as string, runs, syncName, environment_id, activityLogId as number);
if (runs) {
const syncsConfig = await getSyncsByProviderConfigAndSyncName(environment_id, providerConfigKey, syncName);

if (!success) {
return { success, error, response: null };
for (const syncConfig of syncsConfig) {
const { success, error } = await updateSyncScheduleFrequency(
syncConfig.id as string,
syncConfig?.frequency || runs,
syncName,
environment_id,
activityLogId as number
);

if (!success) {
return { success, error, response: null };
}
}
}
}
Expand Down

0 comments on commit 8c8932f

Please sign in to comment.