Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4f274d9

Browse files
authored
fix: Fix for locked DB error (#1834)
* Fix for locked DB errorShould work. Does pause on Updating performers due to lack of log prints in that function* go fmt
1 parentbc2b112 commit4f274d9

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

‎pkg/api/stashdb.go

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ package api
22

33
import (
44
"net/http"
5+
"time"
56

67
"github.com/emicklei/go-restful/v3"
78
"github.com/xbapps/xbvr/pkg/externalreference"
9+
"github.com/xbapps/xbvr/pkg/models"
810
"github.com/xbapps/xbvr/pkg/scrape"
911
)
1012

@@ -32,13 +34,21 @@ func (i ExternalReference) stashRunAll(req *restful.Request, resp *restful.Respo
3234

3335
funcStashdbRunAll() {
3436
gofunc() {
35-
scrape.StashDb()
36-
37-
externalreference.ApplySceneRules()
38-
externalreference.MatchAkaPerformers()
39-
externalreference.UpdateAllPerformerData()
40-
tlog:=log.WithField("task","scrape")
41-
tlog.Info("Stashdb Refresh Complete")
42-
37+
if!models.CheckLock("scrape") {
38+
models.CreateLock("scrape")
39+
defermodels.RemoveLock("scrape")
40+
41+
t0:=time.Now()
42+
tlog:=log.WithField("task","scrape")
43+
tlog.Infof("StashDB Refresh started at %s",t0.Format("Mon Jan _2 15:04:05 2006"))
44+
scrape.StashDb()
45+
46+
externalreference.ApplySceneRules()
47+
externalreference.MatchAkaPerformers()
48+
externalreference.UpdateAllPerformerData()
49+
tlog=log.WithField("task","scrape")
50+
tlog.Infof("Stashdb Refresh Complete in %s",
51+
time.Since(t0).Round(time.Second))
52+
}
4353
}()
4454
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp