Skip to content

Commit

Permalink
refresh cache and insert repo to DB should be in one goroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
reasonerjt committed Sep 28, 2016
1 parent 7219544 commit f22f102
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions service/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -87,14 +81,11 @@ func (n *NotificationHandler) Post() {
if err := dao.AddRepository(repoRecord); err != nil {
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" {
go func() {
Expand Down

0 comments on commit f22f102

Please # to comment.