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

[Code] Improve repository progress polling when clone/index is interrupted by delete #31989

Merged
merged 1 commit into from
Feb 28, 2019
Merged
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
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this return true instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return 'false' to stop polling

}

if (status.deleteStatus) {
Expand Down