git: Fixed unusual but potent race condition

This commit is contained in:
Matthew Holt 2015-05-25 15:39:04 -06:00
parent 346135fed3
commit 6f05794bb8
2 changed files with 4 additions and 3 deletions

View file

@ -62,8 +62,9 @@ type Repo struct {
func (r *Repo) Pull() error {
r.Lock()
defer r.Unlock()
// if it is less than interval since last pull, return
if time.Since(r.lastPull) <= r.Interval {
// prevent a pull if the last one was less than 5 seconds ago
if time.Since(r.lastPull) < 5*time.Second {
return nil
}