Skip to content

Commit

Permalink
enh(connectors): use upsert for github issues (#2306)
Browse files Browse the repository at this point in the history
  • Loading branch information
fontanierh authored Oct 30, 2023
1 parent 85ec50a commit fc59d50
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions connectors/src/connectors/github/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,22 +183,12 @@ export async function githubUpsertIssueActivity(
throw new Error(`Connector not found (installationId: ${installationId})`);
}

const existingIssueInDb = await GithubIssue.findOne({
where: {
repoId: repoId.toString(),
issueNumber,
connectorId: connector.id,
},
localLogger.info("Upserting GitHub issue in DB.");
await GithubIssue.upsert({
repoId: repoId.toString(),
issueNumber,
connectorId: connector.id,
});

if (!existingIssueInDb) {
localLogger.info("Creating new GitHub issue in DB.");
await GithubIssue.create({
repoId: repoId.toString(),
issueNumber,
connectorId: connector.id,
});
}
}

export async function githubUpsertDiscussionActivity(
Expand Down

0 comments on commit fc59d50

Please sign in to comment.