Skip to content

Commit

Permalink
rename workflows with v2
Browse files Browse the repository at this point in the history
  • Loading branch information
aubin-tchoi committed Dec 20, 2024
1 parent b536028 commit ef1ea36
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 30 deletions.
10 changes: 5 additions & 5 deletions connectors/src/connectors/github/temporal/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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),
Expand All @@ -87,7 +87,7 @@ export async function getGithubFullSyncWorkflow(connectorId: ModelId): Promise<{
} | null> {
const client = await getTemporalClient();

const handle: WorkflowHandle<typeof githubSyncAllReposWorkflow> =
const handle: WorkflowHandle<typeof githubFullSyncWorkflowV2> =
client.workflow.getHandle(getFullSyncWorkflowId(connectorId));

try {
Expand Down Expand Up @@ -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),
Expand Down
53 changes: 28 additions & 25 deletions connectors/src/connectors/github/temporal/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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,
Expand All @@ -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],
Expand Down Expand Up @@ -329,7 +329,7 @@ export async function githubRepoIssuesSyncWorkflow({
return true;
}

export async function githubSyncRepoIssuesWorkflow({
export async function githubRepoIssuesSyncWorkflowV2({
dataSourceConfig,
connectorId,
repoName,
Expand Down Expand Up @@ -441,7 +441,7 @@ export async function githubRepoDiscussionsSyncWorkflow({
return cursor;
}

export async function githubSyncRepoDiscussionsWorkflow({
export async function githubRepoDiscussionsSyncWorkflowV2({
dataSourceConfig,
connectorId,
repoName,
Expand Down Expand Up @@ -601,7 +601,7 @@ export async function githubRepoSyncWorkflow({
});
}

export async function githubSyncRepoWorkflow({
export async function githubRepoSyncWorkflowV2({
dataSourceConfig,
connectorId,
repoName,
Expand Down Expand Up @@ -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;
Expand All @@ -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],
Expand Down

0 comments on commit ef1ea36

Please sign in to comment.