Fix: Redundancies

This commit is contained in:
Daniel Hougaard
2024-06-17 13:14:28 +02:00
parent 21c6160c84
commit 0d5514834d
+5 -9
View File
@@ -421,12 +421,9 @@ export const secretQueueFactory = ({
const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath); const folder = await folderDAL.findBySecretPath(projectId, environment, secretPath);
if (!folder) { if (!folder) {
logger.error(new Error("Secret path not found")); throw new Error("Secret path not found");
return;
} }
// start syncing all linked imports also
if (depth < MAX_SYNC_SECRET_DEPTH) {
// find all imports made with the given environment and secret path // find all imports made with the given environment and secret path
const linkSourceDto = { const linkSourceDto = {
projectId, projectId,
@@ -507,9 +504,6 @@ export const secretQueueFactory = ({
) )
); );
} }
} else {
logger.info(`getIntegrationSecrets: Secret depth exceeded for [projectId=${projectId}] [folderId=${folder.id}]`);
}
const integrations = await integrationDAL.findByProjectIdV2(projectId, environment); // note: returns array of integrations + integration auths in this environment const integrations = await integrationDAL.findByProjectIdV2(projectId, environment); // note: returns array of integrations + integration auths in this environment
const toBeSyncedIntegrations = integrations.filter( const toBeSyncedIntegrations = integrations.filter(
@@ -571,10 +565,12 @@ export const secretQueueFactory = ({
syncMessage: "", syncMessage: "",
isSynced: true isSynced: true
}); });
} catch (err: unknown) { } catch (err) {
logger.info("Secret integration sync error: %o", err); logger.info("Secret integration sync error: %o", err);
const message = const message =
err instanceof AxiosError ? JSON.stringify((err as AxiosError)?.response?.data) : (err as Error)?.message; (err instanceof AxiosError ? JSON.stringify(err?.response?.data) : (err as Error)?.message) ||
"Unknown error occurred.";
await integrationDAL.updateById(integration.id, { await integrationDAL.updateById(integration.id, {
lastSyncJobId: job.id, lastSyncJobId: job.id,