Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup(GitHub) - remove all the v2 from the workflow names #9624

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
githubFullSyncWorkflow,
githubIssueGarbageCollectWorkflow,
githubIssueSyncWorkflow,
githubRepoGarbageCollectWorkflow,
githubReposSyncWorkflowV2,
githubReposSyncWorkflow,
} 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(githubFullSyncWorkflowV2, {
await client.workflow.start(githubFullSyncWorkflow, {
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 githubFullSyncWorkflowV2> =
const handle: WorkflowHandle<typeof githubFullSyncWorkflow> =
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(githubReposSyncWorkflowV2, {
await client.workflow.start(githubReposSyncWorkflow, {
args: [dataSourceConfig, connectorId, orgLogin, repos],
taskQueue: QUEUE_NAME,
workflowId: getReposSyncWorkflowId(connectorId),
Expand Down
58 changes: 25 additions & 33 deletions connectors/src/connectors/github/temporal/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ const MAX_CONCURRENT_ISSUE_SYNC_ACTIVITIES_PER_WORKFLOW = 8;

/**
* This workflow is used to fetch and sync all the repositories of a GitHub connector.
* It's called v2 because we had to add it when there was already a workflow without the v2 to avoid non-deterministic errors.
*/
export async function githubFullSyncWorkflowV2(
export async function githubFullSyncWorkflow(
dataSourceConfig: DataSourceConfig,
connectorId: ModelId,
// Used to re-trigger a code-only full-sync after code syncing is enabled/disabled.
Expand Down Expand Up @@ -95,7 +94,7 @@ export async function githubFullSyncWorkflowV2(
const childWorkflowId = `${fullSyncWorkflowId}-repo-${repo.id}-syncCodeOnly-${syncCodeOnly}`;
promises.push(
queue.add(() =>
executeChild(githubRepoSyncWorkflowV2, {
executeChild(githubRepoSyncWorkflow, {
workflowId: childWorkflowId,
searchAttributes: {
connectorId: [connectorId],
Expand Down Expand Up @@ -127,9 +126,8 @@ export async function githubFullSyncWorkflowV2(

/**
* This workflow is used to sync the given repositories of a GitHub connector.
* It's called v2 because we had to add it when there was already a workflow without the v2 to avoid non-deterministic errors.
*/
export async function githubReposSyncWorkflowV2(
export async function githubReposSyncWorkflow(
dataSourceConfig: DataSourceConfig,
connectorId: ModelId,
orgLogin: string,
Expand All @@ -143,7 +141,7 @@ export async function githubReposSyncWorkflowV2(
const childWorkflowId = `${reposSyncWorkflowId}-repo-${repo.id}`;
promises.push(
queue.add(() =>
executeChild(githubRepoSyncWorkflowV2, {
executeChild(githubRepoSyncWorkflow, {
workflowId: childWorkflowId,
searchAttributes: {
connectorId: [connectorId],
Expand Down Expand Up @@ -172,9 +170,8 @@ export async function githubReposSyncWorkflowV2(

/**
* This workflow is used to sync all the issues of a GitHub connector.
* It's called v2 because we had to add it when there was already a workflow without the v2 to avoid non-deterministic errors.
*/
export async function githubRepoIssuesSyncWorkflowV2({
export async function githubRepoIssuesSyncWorkflow({
dataSourceConfig,
connectorId,
repoName,
Expand Down Expand Up @@ -233,9 +230,8 @@ export async function githubRepoIssuesSyncWorkflowV2({

/**
* This workflow is used to sync all the discussions of a GitHub connector.
* It's called v2 because we had to add it when there was already a workflow without the v2 to avoid non-deterministic errors.
*/
export async function githubRepoDiscussionsSyncWorkflowV2({
export async function githubRepoDiscussionsSyncWorkflow({
dataSourceConfig,
connectorId,
repoName,
Expand Down Expand Up @@ -291,9 +287,8 @@ export async function githubRepoDiscussionsSyncWorkflowV2({

/**
* This workflow is used to sync all the issues, discussions and code of a GitHub connector.
* It's called v2 because we had to add it when there was already a workflow without the v2 to avoid non-deterministic errors.
*/
export async function githubRepoSyncWorkflowV2({
export async function githubRepoSyncWorkflow({
dataSourceConfig,
connectorId,
repoName,
Expand Down Expand Up @@ -324,27 +319,24 @@ export async function githubRepoSyncWorkflowV2({
: getReposSyncWorkflowId(connectorId)
}-repo-${repoId}-issues-page-${pageNumber}`;

const shouldContinue = await executeChild(
githubRepoIssuesSyncWorkflowV2,
{
workflowId: childWorkflowId,
searchAttributes: {
connectorId: [connectorId],
const shouldContinue = await executeChild(githubRepoIssuesSyncWorkflow, {
workflowId: childWorkflowId,
searchAttributes: {
connectorId: [connectorId],
},
args: [
{
dataSourceConfig,
connectorId,
repoName,
repoId,
repoLogin,
pageNumber,
},
args: [
{
dataSourceConfig,
connectorId,
repoName,
repoId,
repoLogin,
pageNumber,
},
],
parentClosePolicy: ParentClosePolicy.PARENT_CLOSE_POLICY_TERMINATE,
memo: workflowInfo().memo,
}
);
],
parentClosePolicy: ParentClosePolicy.PARENT_CLOSE_POLICY_TERMINATE,
memo: workflowInfo().memo,
});

if (!shouldContinue) {
break;
Expand All @@ -361,7 +353,7 @@ export async function githubRepoSyncWorkflowV2({
: getReposSyncWorkflowId(connectorId)
}-repo-${repoId}-issues-page-${cursorIteration}`;

nextCursor = await executeChild(githubRepoDiscussionsSyncWorkflowV2, {
nextCursor = await executeChild(githubRepoDiscussionsSyncWorkflow, {
workflowId: childWorkflowId,
searchAttributes: {
connectorId: [connectorId],
Expand Down
Loading