camweb: make syncing to github concurrent

Camweb is in charge of syncing the commits from the gerrit repository to
our mirror on github.

It also sends the commits as e-mails to the Camlistore mailing-list.

The former was only happening after the latter did, but there was no
reason to do it that way, as these tasks are independent. Moreover, when
sending e-mails is problematic (issue #980), it delays syncing to
github.

This change therefore makes syncing to github concurrent with
sending the e-mails.

Change-Id: I63a2b3f5b49df58ca30ec5153ce65eafb44b5b28
This commit is contained in:
mpl 2017-12-05 17:49:05 +01:00
parent a91a98c58a
commit 31389f8ab2
1 changed files with 10 additions and 5 deletions

View File

@ -229,6 +229,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
@ -254,11 +263,7 @@ func pollCommits(dir string) {
}
}
}
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) {