Skip to content

Commit

Permalink
[Code] Improve repository progress polling when clone/index is interr…
Browse files Browse the repository at this point in the history
…upted by delete (#31989)
  • Loading branch information
mw-ding authored Feb 28, 2019
1 parent c5cbfe3 commit 49505a0
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions x-pack/plugins/code/public/sagas/project_status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ const handleRepoCloneStatusPolling = createRepoStatusPollingHandler(
}
},
function*(status: any, repoUri: RepositoryUri) {
if (
// Repository has been deleted during the clone
(!status.gitStatus && !status.indexStatus && !status.deleteStatus) ||
// Repository is in delete during the clone
status.deleteStatus
) {
// Stop polling git progress
return false;
}

if (status.gitStatus) {
const { progress, cloneProgress } = status.gitStatus;
yield put(
Expand Down Expand Up @@ -180,6 +190,16 @@ const handleRepoIndexStatusPolling = createRepoStatusPollingHandler(
}
},
function*(status: any, repoUri: RepositoryUri) {
if (
// Repository has been deleted during the index
(!status.gitStatus && !status.indexStatus && !status.deleteStatus) ||
// Repository is in delete during the index
status.deleteStatus
) {
// Stop polling index progress
return false;
}

if (status.indexStatus) {
yield put(
updateIndexProgress({
Expand Down Expand Up @@ -222,6 +242,7 @@ const handleRepoDeleteStatusPolling = createRepoStatusPollingHandler(
repoUri,
})
);
return false;
}

if (status.deleteStatus) {
Expand Down

0 comments on commit 49505a0

Please sign in to comment.