mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 02:35:17 +01:00
refresh cache and insert repo to DB should be in one goroutine
This commit is contained in:
parent
7219544bba
commit
f22f102654
@ -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)
|
||||
}
|
||||
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() {
|
||||
|
Loading…
Reference in New Issue
Block a user