-
Notifications
You must be signed in to change notification settings - Fork 1k
source_manager.go handle locking better #853
Conversation
Fix nit around capital letter in error message.
…ss. We should not allow NewSourceManager to be called twice at the same time.
once more, with feeling. |
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.
just nits, really - it's awesome how neatly that lib fits in!
internal/gps/source_manager.go
Outdated
} | ||
} | ||
|
||
// there is a lockfile, but it's owned by someone else. We'll try to lock |
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.
nit: capitalize 😄
internal/gps/source_manager.go
Outdated
// permanently. | ||
|
||
err = lockfile.TryLock() | ||
for err != nil { |
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.
Having this loop be effectively unbounded AND not providing the user any feedback seems concerning. But, I'd be OK with addressing that in a follow-up - though, please make a comment on #534, as I think that'll be the appropriate way to tell the user this is happening.
// Fix for #820 | ||
// | ||
// Consult https://godoc.org/github.com/nightlyone/lockfile for the lockfile | ||
// behaviour. It's magic. It deals with stale processes, and if there is |
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.
And close... |
And open! |
ok, i think we're looking good for this. i'll open a follow-up related to refactoring the interface. |
oh, and, woohoo! 🎉 |
What does this do / why do we need it?
Adds https://github.com/nightlyone/lockfile to manage the lockfile that dep uses. Concurrent use of dep no longer fails, subsequence invocations of dep will cause the subsequence instances to wait while the first runs, and then they will continue.
Also, stale lockfiles are handled correctly.
What should your reviewer look out for in this PR?
Correctness.
Do you need help or clarification on anything?
How to use git ... ;-)
Which issue(s) does this PR fix?
fixes #820
fixes #852