From 6f05794bb86e68f8160aaa0fc68213ca373dc4d1 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 25 May 2015 15:39:04 -0600 Subject: [PATCH] git: Fixed unusual but potent race condition --- config/setup/tls.go | 2 +- middleware/git/git.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/setup/tls.go b/config/setup/tls.go index 9d36c7ec..94f2e11b 100644 --- a/config/setup/tls.go +++ b/config/setup/tls.go @@ -82,7 +82,7 @@ func TLS(c *Controller) (middleware.Middleware, error) { } // Map of supported protocols -// SSLv3 will be not supported in next release +// SSLv3 will be not supported in future release // HTTP/2 only supports TLS 1.2 and higher var supportedProtocols = map[string]uint16{ "ssl3.0": tls.VersionSSL30, diff --git a/middleware/git/git.go b/middleware/git/git.go index 0c87cdb8..d81421c9 100644 --- a/middleware/git/git.go +++ b/middleware/git/git.go @@ -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 }