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