Skip to content

Commit 6e0595f

Browse files
committed
fix(connectors): forward rehydrate flag through the Trigger.dev worker
executeConnectorSyncJob (the production async sync path) destructured only fullSync from the payload and forwarded only fullSync to executeSync, silently dropping rehydrate. A manual Full resync would therefore never re-hydrate on the default Trigger.dev path. Forward rehydrate too.
1 parent 60d2b80 commit 6e0595f

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

apps/sim/background/knowledge-connector-sync.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,29 @@ describe('knowledge connector sync worker', () => {
7272
expect(mockExecuteSync).toHaveBeenCalledWith('connector-1', {
7373
billingAttribution: BILLING_ATTRIBUTION,
7474
fullSync: true,
75+
rehydrate: undefined,
76+
})
77+
})
78+
79+
it('forwards the rehydrate flag to the sync engine (async worker path)', async () => {
80+
mockAssertConnectorSyncPayload.mockReturnValue({
81+
connectorId: 'connector-1',
82+
requestId: 'request-1',
83+
rehydrate: true,
84+
billingAttribution: BILLING_ATTRIBUTION,
85+
})
86+
87+
await executeConnectorSyncJob({
88+
connectorId: 'connector-1',
89+
requestId: 'request-1',
90+
rehydrate: true,
91+
billingAttribution: BILLING_ATTRIBUTION,
92+
})
93+
94+
expect(mockExecuteSync).toHaveBeenCalledWith('connector-1', {
95+
billingAttribution: BILLING_ATTRIBUTION,
96+
fullSync: undefined,
97+
rehydrate: true,
7598
})
7699
})
77100
})

apps/sim/background/knowledge-connector-sync.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import { executeSync } from '@/lib/knowledge/connectors/sync-engine'
99
const logger = createLogger('TriggerKnowledgeConnectorSync')
1010

1111
export async function executeConnectorSyncJob(payload: unknown) {
12-
const { connectorId, fullSync, requestId, billingAttribution } =
12+
const { connectorId, fullSync, rehydrate, requestId, billingAttribution } =
1313
assertConnectorSyncPayload(payload)
1414

1515
logger.info(`[${requestId}] Starting connector sync: ${connectorId}`)
1616

1717
try {
18-
const result = await executeSync(connectorId, { billingAttribution, fullSync })
18+
const result = await executeSync(connectorId, { billingAttribution, fullSync, rehydrate })
1919

2020
logger.info(`[${requestId}] Connector sync completed`, {
2121
connectorId,

0 commit comments

Comments
 (0)