-
Notifications
You must be signed in to change notification settings - Fork 887
feat: add provisioner job hang detector #7927
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
Changes from 3 commits
a38e949
dfaf836
530e8f2
027443a
0218151
9e0ae3b
590f76a
6f1e127
e284b47
0b9e78a
8f16c3b
f25938a
aa36a0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
package database | ||
|
||
// Well-known lock IDs for lock functions in the database. These should not | ||
// change. If locks are deprecated, they should be kept to avoid reusing the | ||
// same ID. | ||
// change. If locks are deprecated, they should be kept in this list to avoid | ||
// reusing the same ID. | ||
const ( | ||
LockIDDeploymentSetup = iota + 1 | ||
lockIDUnused = iota | ||
LockIDDeploymentSetup = iota | ||
LockIDHangDetector = iota | ||
deansheather marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,3 +96,13 @@ SET | |
error_code = $5 | ||
WHERE | ||
id = $1; | ||
|
||
-- name: GetHungProvisionerJobs :many | ||
SELECT | ||
* | ||
FROM | ||
provisioner_jobs | ||
WHERE | ||
updated_at < $1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor semantic sanity check, do we want inclusive or exclusive check here? I do feel like <= would make sense here considering the terminology (hung since). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it matters since it's time comparison, so the precision is millisecond (or smaller) and the chance of a collision is tiny (and doesn't have any consequence) |
||
AND started_at IS NOT NULL | ||
AND completed_at IS NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since unhanger has no
Close
method, nor isRun
blocking, we have no way to ensure this service is actually shut down on exit. Ideally we would replacectx
dependence outsideNew
function with a synchronousClose
method to ensure cleanup. Alternatively we could defer<-hangDetector.Wait()
but then the caller must be careful to cancel the context later in the stack (easier to make mistakes).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a Close function which cancels the context