Skip to content

Commit

Permalink
fix(api): sync progress
Browse files Browse the repository at this point in the history
  • Loading branch information
waltergalvao committed Jul 9, 2024
1 parent f47bb9b commit fe17756
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions apps/api/src/app/github/services/github-pull-request.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ type RepositoryData = Omit<
export const syncPullRequest = async (
gitInstallationId: number,
pullRequestId: string,
{ syncReviews, initialSync } = {
{ syncReviews, initialSync, failCount } = {
syncReviews: false,
initialSync: false,
failCount: 0,
}
) => {
logger.info("syncPullRequest", {
Expand All @@ -59,6 +60,10 @@ export const syncPullRequest = async (
return;
}

if (initialSync && failCount === 0) {
incrementInitialSyncProgress(workspace.id, "done", 1);
}

const gitPrData = await fetchPullRequest(gitInstallationId, pullRequestId);

if (gitPrData.repository.isFork) {
Expand Down Expand Up @@ -86,10 +91,6 @@ export const syncPullRequest = async (
gitPrData
);

if (initialSync) {
incrementInitialSyncProgress(workspace.id, "done", 1);
}

if (syncReviews) {
logger.debug("syncPullRequest: Adding job to sync reviews", {
gitPrData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const syncPullRequestWorker = createWorker(
const options = {
syncReviews: job.data.syncReviews || false,
initialSync: job.data.initialSync || false,
failCount: job.attemptsMade,
};

await withDelayedRetryOnRateLimit(
Expand Down

0 comments on commit fe17756

Please sign in to comment.