Skip to content

Commit

Permalink
[gh-#847] delete syncs for config
Browse files Browse the repository at this point in the history
  • Loading branch information
khaliqgant committed Jul 26, 2023
1 parent dfab7ae commit 84d9f4b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/shared/lib/services/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import path from 'path';
import { isCloud, dirname } from '../utils/utils.js';
import { NangoError } from '../utils/error.js';
import encryptionManager from '../utils/encryption.manager.js';
import { deleteScheduleForProviderConfig as deleteSyncScheduleForProviderConfig } from '../services/sync/schedule.service.js';
import syncOrchestrator from './sync/orchestrator.service.js';
import { deleteSyncFilesForConfig, deleteByConfigId as deleteSyncConfigByConfigId } from '../services/sync/config.service.js';

class ConfigService {
Expand Down Expand Up @@ -130,7 +130,7 @@ class ConfigService {
throw new NangoError('unknown_provider_config');
}

await deleteSyncScheduleForProviderConfig(environment_id, providerConfigKey);
await syncOrchestrator.deleteSyncsByProviderConfig(environment_id, providerConfigKey);

if (isCloud()) {
const config = await this.getProviderConfig(providerConfigKey, environment_id);
Expand Down
12 changes: 0 additions & 12 deletions packages/shared/lib/services/sync/schedule.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,6 @@ export const deleteScheduleForSync = async (sync_id: string): Promise<void> => {
}
};

export const deleteScheduleForProviderConfig = async (environmentId: number, providerConfigKey: string): Promise<void> => {
const syncs = await getSyncsByProviderConfigKey(environmentId, providerConfigKey);

if (!syncs) {
return;
}

for (const sync of syncs) {
await deleteScheduleForSync(sync.id as string);
}
};

export const markAllAsStopped = async (): Promise<void> => {
await schema().update({ status: ScheduleStatus.STOPPED }).from<SyncSchedule>(TABLE);
};
Expand Down

0 comments on commit 84d9f4b

Please sign in to comment.