From 31389f8ab28ff7b6b7c340078429b3c38be6a918 Mon Sep 17 00:00:00 2001 From: mpl Date: Tue, 5 Dec 2017 17:49:05 +0100 Subject: [PATCH] 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 --- website/email.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/website/email.go b/website/email.go index 480867508..480c14dae 100644 --- a/website/email.go +++ b/website/email.go @@ -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) {