Backend: Update photo counts after sync download
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
984ffb511d
commit
71c849c23b
7 changed files with 29 additions and 7 deletions
4
Makefile
4
Makefile
|
@ -102,8 +102,8 @@ test-verbose:
|
|||
$(info Running all Go unit tests in verbose mode...)
|
||||
$(GOTEST) -parallel 1 -count 1 -cpu 1 -tags slow -timeout 20m -v ./pkg/... ./internal/...
|
||||
test-short:
|
||||
$(info Running short Go unit tests in verbose mode...)
|
||||
$(GOTEST) -parallel 1 -count 1 -cpu 1 -short -timeout 5m -v ./pkg/... ./internal/...
|
||||
$(info Running short Go unit tests in parallel mode...)
|
||||
$(GOTEST) -parallel 2 -count 1 -cpu 2 -short -timeout 5m ./pkg/... ./internal/...
|
||||
test-race:
|
||||
$(info Running all Go unit tests with race detection in verbose mode...)
|
||||
$(GOTEST) -tags slow -race -timeout 60m -v ./pkg/... ./internal/...
|
||||
|
|
|
@ -76,6 +76,8 @@ func UpdatePhoto(router *gin.RouterGroup, conf *config.Config) {
|
|||
return
|
||||
}
|
||||
|
||||
log.Info("photo: updating related entity counts")
|
||||
|
||||
if err := query.UpdatePhotoCounts(); err != nil {
|
||||
log.Errorf("photo: %s", err)
|
||||
}
|
||||
|
|
|
@ -71,6 +71,8 @@ func AddPhotoLabel(router *gin.RouterGroup, conf *config.Config) {
|
|||
return
|
||||
}
|
||||
|
||||
log.Info("photo: updating related entity counts")
|
||||
|
||||
if err := query.UpdatePhotoCounts(); err != nil {
|
||||
log.Errorf("photo: %s", err)
|
||||
}
|
||||
|
@ -135,6 +137,8 @@ func RemovePhotoLabel(router *gin.RouterGroup, conf *config.Config) {
|
|||
return
|
||||
}
|
||||
|
||||
log.Info("photo: updating related entity counts")
|
||||
|
||||
if err := query.UpdatePhotoCounts(); err != nil {
|
||||
log.Errorf("photo: %s", err)
|
||||
}
|
||||
|
|
|
@ -195,8 +195,12 @@ func (imp *Import) Start(opt ImportOptions) map[string]bool {
|
|||
log.Error(err.Error())
|
||||
}
|
||||
|
||||
if err := query.UpdatePhotoCounts(); err != nil {
|
||||
log.Errorf("import: %s", err)
|
||||
if len(done) > 0 {
|
||||
log.Info("import: updating photo counts")
|
||||
|
||||
if err := query.UpdatePhotoCounts(); err != nil {
|
||||
log.Errorf("import: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
runtime.GC()
|
||||
|
|
|
@ -171,8 +171,12 @@ func (ind *Index) Start(opt IndexOptions) map[string]bool {
|
|||
log.Error(err.Error())
|
||||
}
|
||||
|
||||
if err := query.UpdatePhotoCounts(); err != nil {
|
||||
log.Errorf("index: %s", err)
|
||||
if len(done) > 0 {
|
||||
log.Info("index: updating photo counts")
|
||||
|
||||
if err := query.UpdatePhotoCounts(); err != nil {
|
||||
log.Errorf("index: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
runtime.GC()
|
||||
|
|
|
@ -175,7 +175,7 @@ func (prg *Purge) Start(opt PurgeOptions) (purgedFiles map[string]bool, purgedPh
|
|||
log.Info("purge: updating photo counts")
|
||||
|
||||
if err := query.UpdatePhotoCounts(); err != nil {
|
||||
return purgedFiles, purgedPhotos, err
|
||||
log.Errorf("purge: %s", err)
|
||||
}
|
||||
|
||||
return purgedFiles, purgedPhotos, nil
|
||||
|
|
|
@ -179,5 +179,13 @@ func (s *Sync) download(a entity.Account) (complete bool, err error) {
|
|||
}
|
||||
}
|
||||
|
||||
if len(done) > 0 {
|
||||
log.Info("sync: updating photo counts")
|
||||
|
||||
if err := query.UpdatePhotoCounts(); err != nil {
|
||||
log.Errorf("sync: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue