mirror of https://github.com/perkeep/perkeep.git
Merge "camweb: make syncing to github concurrent"
This commit is contained in:
commit
286dbacc62
|
@ -243,6 +243,15 @@ func pollCommits(dir string) {
|
||||||
latestHash.Lock()
|
latestHash.Lock()
|
||||||
latestHash.s = hashes[0]
|
latestHash.s = hashes[0]
|
||||||
latestHash.Unlock()
|
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 {
|
for _, commit := range hashes {
|
||||||
if knownCommit[commit] {
|
if knownCommit[commit] {
|
||||||
continue
|
continue
|
||||||
|
@ -270,11 +279,7 @@ func pollCommits(dir string) {
|
||||||
log.Printf("datastore put of git_commit(%v): %v", commit, err)
|
log.Printf("datastore put of git_commit(%v): %v", commit, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if githubSSHKey != "" {
|
<-githubSyncC
|
||||||
if err := syncToGithub(dir, hashes[0]); err != nil {
|
|
||||||
log.Printf("Failed to push commit %v to github: %v", hashes[0], err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func recentCommits(dir string) (hashes []string, err error) {
|
func recentCommits(dir string) (hashes []string, err error) {
|
||||||
|
|
Loading…
Reference in New Issue