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

Canceling running job #5

Open
3 tasks
Azhng opened this issue Jun 9, 2020 · 1 comment · May be fixed by sexxi-goose/sexxi-webhook#4
Open
3 tasks

Canceling running job #5

Azhng opened this issue Jun 9, 2020 · 1 comment · May be fixed by sexxi-goose/sexxi-webhook#4
Assignees

Comments

@Azhng
Copy link
Contributor

Azhng commented Jun 9, 2020

We need to cancel jobs upon three conditions:

  • Timeout
  • When user force push to the same branch and overwrite the commits
  • When user manually cancels the job by unassigning the bot from reviewer assignee

Parent issue: #2

@Azhng
Copy link
Contributor Author

Azhng commented Jun 9, 2020

I'm not too familiar with how the canonical way of implementing this in Rust. But in Golang, this is implemented using context and channel. We can simulate this in rust using tokio's task and select! macro.

This is what I have in mind:

let job = job_registry.get(job_id);
select! {
     _ = start_build_job(job).await {
           // handle success
     }
    _ = waiting_for_context_cancel().await {
          // handle cancel
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants