Merge "camweb: make syncing to github concurrent"

This commit is contained in:
Mathieu Lonjaret 2017-12-15 00:08:13 +00:00 committed by Gerrit Code Review
commit 286dbacc62
1 changed files with 10 additions and 5 deletions

View File

@ -243,6 +243,15 @@ func pollCommits(dir string) {
latestHash.Lock()
latestHash.s = hashes[0]
latestHash.Unlock()
githubSyncC := make(chan bool, 1)
go func() {
if githubSSHKey != "" {
if err := syncToGithub(dir, hashes[0]); err != nil {
log.Printf("Failed to push commit %v to github: %v", hashes[0], err)
}
}
githubSyncC <- true
}()
for _, commit := range hashes {
if knownCommit[commit] {
continue
@ -270,11 +279,7 @@ func pollCommits(dir string) {
log.Printf("datastore put of git_commit(%v): %v", commit, err)
}
}
if githubSSHKey != "" {
if err := syncToGithub(dir, hashes[0]); err != nil {
log.Printf("Failed to push commit %v to github: %v", hashes[0], err)
}
}
<-githubSyncC
}
func recentCommits(dir string) (hashes []string, err error) {