diff --git a/connectors/src/connectors/github/temporal/client.ts b/connectors/src/connectors/github/temporal/client.ts index defa9ec67359..78a0b26441f6 100644 --- a/connectors/src/connectors/github/temporal/client.ts +++ b/connectors/src/connectors/github/temporal/client.ts @@ -23,11 +23,11 @@ import { githubCodeSyncWorkflow, githubDiscussionGarbageCollectWorkflow, githubDiscussionSyncWorkflow, + githubFullSyncWorkflowV2, githubIssueGarbageCollectWorkflow, githubIssueSyncWorkflow, githubRepoGarbageCollectWorkflow, - githubSyncAllReposWorkflow, - githubSyncReposWorkflow, + githubReposSyncWorkflowV2, } from "@connectors/connectors/github/temporal/workflows"; import { dataSourceConfigFromConnector } from "@connectors/lib/api/data_source_config"; import { getTemporalClient } from "@connectors/lib/temporal"; @@ -68,7 +68,7 @@ export async function launchGithubFullSyncWorkflow({ return; } - await client.workflow.start(githubSyncAllReposWorkflow, { + await client.workflow.start(githubFullSyncWorkflowV2, { args: [dataSourceConfig, connectorId, syncCodeOnly, forceCodeResync], taskQueue: QUEUE_NAME, workflowId: getFullSyncWorkflowId(connectorId), @@ -87,7 +87,7 @@ export async function getGithubFullSyncWorkflow(connectorId: ModelId): Promise<{ } | null> { const client = await getTemporalClient(); - const handle: WorkflowHandle = + const handle: WorkflowHandle = client.workflow.getHandle(getFullSyncWorkflowId(connectorId)); try { @@ -116,7 +116,7 @@ export async function launchGithubReposSyncWorkflow( } const dataSourceConfig = dataSourceConfigFromConnector(connector); - await client.workflow.start(githubSyncReposWorkflow, { + await client.workflow.start(githubReposSyncWorkflowV2, { args: [dataSourceConfig, connectorId, orgLogin, repos], taskQueue: QUEUE_NAME, workflowId: getReposSyncWorkflowId(connectorId), diff --git a/connectors/src/connectors/github/temporal/workflows.ts b/connectors/src/connectors/github/temporal/workflows.ts index 76d0f6d17f34..5adcbf92e7ff 100644 --- a/connectors/src/connectors/github/temporal/workflows.ts +++ b/connectors/src/connectors/github/temporal/workflows.ts @@ -125,7 +125,7 @@ export async function githubFullSyncWorkflow( await githubSaveSuccessSyncActivity(dataSourceConfig); } -export async function githubSyncAllReposWorkflow( +export async function githubFullSyncWorkflowV2( dataSourceConfig: DataSourceConfig, connectorId: ModelId, // Used to re-trigger a code-only full-sync after code syncing is enabled/disabled. @@ -155,7 +155,7 @@ export async function githubSyncAllReposWorkflow( const childWorkflowId = `${fullSyncWorkflowId}-repo-${repo.id}-syncCodeOnly-${syncCodeOnly}`; promises.push( queue.add(() => - executeChild(githubSyncRepoWorkflow, { + executeChild(githubRepoSyncWorkflowV2, { workflowId: childWorkflowId, searchAttributes: { connectorId: [connectorId], @@ -230,7 +230,7 @@ export async function githubReposSyncWorkflow( await githubSaveSuccessSyncActivity(dataSourceConfig); } -export async function githubSyncReposWorkflow( +export async function githubReposSyncWorkflowV2( dataSourceConfig: DataSourceConfig, connectorId: ModelId, orgLogin: string, @@ -244,7 +244,7 @@ export async function githubSyncReposWorkflow( const childWorkflowId = `${reposSyncWorkflowId}-repo-${repo.id}`; promises.push( queue.add(() => - executeChild(githubSyncRepoWorkflow, { + executeChild(githubRepoSyncWorkflowV2, { workflowId: childWorkflowId, searchAttributes: { connectorId: [connectorId], @@ -329,7 +329,7 @@ export async function githubRepoIssuesSyncWorkflow({ return true; } -export async function githubSyncRepoIssuesWorkflow({ +export async function githubRepoIssuesSyncWorkflowV2({ dataSourceConfig, connectorId, repoName, @@ -441,7 +441,7 @@ export async function githubRepoDiscussionsSyncWorkflow({ return cursor; } -export async function githubSyncRepoDiscussionsWorkflow({ +export async function githubRepoDiscussionsSyncWorkflowV2({ dataSourceConfig, connectorId, repoName, @@ -601,7 +601,7 @@ export async function githubRepoSyncWorkflow({ }); } -export async function githubSyncRepoWorkflow({ +export async function githubRepoSyncWorkflowV2({ dataSourceConfig, connectorId, repoName, @@ -632,24 +632,27 @@ export async function githubSyncRepoWorkflow({ : getReposSyncWorkflowId(connectorId) }-repo-${repoId}-issues-page-${pageNumber}`; - const shouldContinue = await executeChild(githubSyncRepoIssuesWorkflow, { - workflowId: childWorkflowId, - searchAttributes: { - connectorId: [connectorId], - }, - args: [ - { - dataSourceConfig, - connectorId, - repoName, - repoId, - repoLogin, - pageNumber, + const shouldContinue = await executeChild( + githubRepoIssuesSyncWorkflowV2, + { + workflowId: childWorkflowId, + searchAttributes: { + connectorId: [connectorId], }, - ], - parentClosePolicy: ParentClosePolicy.PARENT_CLOSE_POLICY_TERMINATE, - memo: workflowInfo().memo, - }); + args: [ + { + dataSourceConfig, + connectorId, + repoName, + repoId, + repoLogin, + pageNumber, + }, + ], + parentClosePolicy: ParentClosePolicy.PARENT_CLOSE_POLICY_TERMINATE, + memo: workflowInfo().memo, + } + ); if (!shouldContinue) { break; @@ -666,7 +669,7 @@ export async function githubSyncRepoWorkflow({ : getReposSyncWorkflowId(connectorId) }-repo-${repoId}-issues-page-${cursorIteration}`; - nextCursor = await executeChild(githubSyncRepoDiscussionsWorkflow, { + nextCursor = await executeChild(githubRepoDiscussionsSyncWorkflowV2, { workflowId: childWorkflowId, searchAttributes: { connectorId: [connectorId],