refresh cache and insert repo to DB should be in one goroutine

This commit is contained in:
Tan Jiang 2016-09-28 14:36:09 +08:00
parent 7219544bba
commit f22f102654

View File

@ -71,12 +71,6 @@ func (n *NotificationHandler) Post() {
} }
}() }()
if action == "push" { if action == "push" {
go func() {
if err := cache.RefreshCatalogCache(); err != nil {
log.Errorf("failed to refresh cache: %v", err)
}
}()
go func() { go func() {
exist := dao.RepositoryExists(repository) exist := dao.RepositoryExists(repository)
if exist { if exist {
@ -87,14 +81,11 @@ func (n *NotificationHandler) Post() {
if err := dao.AddRepository(repoRecord); err != nil { if err := dao.AddRepository(repoRecord); err != nil {
log.Errorf("Error happens when adding repository: %v", err) log.Errorf("Error happens when adding repository: %v", err)
} }
}() if err := cache.RefreshCatalogCache(); err != nil {
log.Errorf("failed to refresh cache: %v", err)
operation := ""
if action == "push" {
operation = models.RepOpTransfer
} }
}()
go api.TriggerReplicationByRepository(repository, []string{tag}, operation) go api.TriggerReplicationByRepository(repository, []string{tag}, models.RepOpTransfer)
} }
if action == "pull" { if action == "pull" {
go func() { go func() {