Skip to content

Commit

Permalink
fix update time
Browse files Browse the repository at this point in the history
  • Loading branch information
faceair committed Nov 30, 2018
1 parent 73847e3 commit e0edf74
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
)

var urlRegex = regexp.MustCompile(`([A-Za-z0-9_.-]+((/[A-Za-z0-9_.-]+)+?)?)/?(/info/refs|/git-upload-pack|\?go-get=1)`)
var repoRegex = regexp.MustCompile(`content="(.+?)\s*git\s*(.+)?"`)
var repoRegex = regexp.MustCompile(`content="(.+?)\s+git\s+(.+)?"`)

// NewServer create a Server instance
// The gopath should be a valid folder and will store git repositories later
Expand Down Expand Up @@ -136,7 +136,7 @@ func (g *Server) cloneLoop() {
func (g *Server) shouldUpdate(repoPath string) bool {
now := time.Now()
if ut, ok := g.upTime.Load(repoPath); ok {
if ut.(time.Time).Sub(now) < time.Hour {
if now.Sub(ut.(time.Time)) < time.Hour {
return false
}
}
Expand Down

0 comments on commit e0edf74

Please sign in to comment.