Skip to content

Commit

Permalink
spread the confluence workflows every 2 hours instead of every hour (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aubin-tchoi authored Dec 23, 2024
1 parent 63b09b5 commit b950330
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion connectors/src/connectors/confluence/temporal/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export async function launchConfluenceSyncWorkflow(
const workflowId = makeConfluenceSyncWorkflowId(connector.id);

const minute = connector.id % 60; // Spread workflows across the hour.
const oddOrEvenHour = connector.id % 120 >= 60 ? 1 : 0; // Spread workflows on even or odd hours.

// When the workflow is inactive, we omit passing spaceIds as they are only used to signal modifications within a currently active full sync workflow.
try {
Expand All @@ -70,7 +71,7 @@ export async function launchConfluenceSyncWorkflow(
memo: {
connectorId,
},
cronSchedule: `${minute} * * * *`, // Every hour at minute `minute`.
cronSchedule: `${minute} ${oddOrEvenHour}/2 * * *`, // Every 2 hours at minute `minute`.
});
} catch (err) {
return new Err(err as Error);
Expand Down

0 comments on commit b950330

Please sign in to comment.