mirror of
https://github.com/photoprism/photoprism.git
synced 2026-01-23 02:24:24 +00:00
Workers: Apply "golangci-lint" recommendations #5330
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
01c8dd0a10
commit
cc651a84d0
6 changed files with 11 additions and 12 deletions
|
|
@ -43,7 +43,7 @@ func mustImport(delay time.Duration) bool {
|
|||
importMutex.Lock()
|
||||
defer importMutex.Unlock()
|
||||
|
||||
return !autoImport.IsZero() && autoImport.Sub(time.Now()) < -1*delay && !mutex.IndexWorker.Running()
|
||||
return !autoImport.IsZero() && time.Until(autoImport) < -1*delay && !mutex.IndexWorker.Running()
|
||||
}
|
||||
|
||||
// Import starts importing originals e.g. after WebDAV uploads.
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ func mustIndex(delay time.Duration) bool {
|
|||
indexMutex.Lock()
|
||||
defer indexMutex.Unlock()
|
||||
|
||||
return !autoIndex.IsZero() && autoIndex.Sub(time.Now()) < -1*delay && !mutex.IndexWorker.Running()
|
||||
return !autoIndex.IsZero() && time.Until(autoIndex) < -1*delay && !mutex.IndexWorker.Running()
|
||||
}
|
||||
|
||||
// Index starts indexing originals e.g. after WebDAV uploads.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
Jobs map[string]gocron.Job
|
||||
// Jobs keeps the scheduled background jobs keyed by name.
|
||||
Jobs map[string]gocron.Job
|
||||
// Scheduler is the shared job scheduler instance.
|
||||
Scheduler gocron.Scheduler
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -97,11 +97,12 @@ func (w *Sync) Start() (err error) {
|
|||
accErrors = 0
|
||||
accError = ""
|
||||
|
||||
if a.SyncDownload {
|
||||
switch {
|
||||
case a.SyncDownload:
|
||||
syncStatus = entity.SyncStatusDownload
|
||||
} else if a.SyncUpload {
|
||||
case a.SyncUpload:
|
||||
syncStatus = entity.SyncStatusUpload
|
||||
} else {
|
||||
default:
|
||||
syncStatus = entity.SyncStatusSynced
|
||||
syncDate.Time = time.Now()
|
||||
syncDate.Valid = true
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import (
|
|||
"github.com/photoprism/photoprism/pkg/fs"
|
||||
)
|
||||
|
||||
// Downloads groups files to sync by their directory/prefix.
|
||||
type Downloads map[string][]entity.FileSync
|
||||
|
||||
// downloadPath returns a temporary download path.
|
||||
|
|
|
|||
|
|
@ -83,11 +83,6 @@ func (w *Vision) scheduledModels() []string {
|
|||
return models
|
||||
}
|
||||
|
||||
// originalsPath returns the path that holds original media files.
|
||||
func (w *Vision) originalsPath() string {
|
||||
return w.conf.OriginalsPath()
|
||||
}
|
||||
|
||||
// Start runs the requested vision models against photos matching the search
|
||||
// filter. `customSrc` allows the caller to override the metadata source string,
|
||||
// `force` regenerates metadata regardless of existing values, and `runType`
|
||||
|
|
@ -194,7 +189,7 @@ func (w *Vision) Start(filter string, count int, models []string, customSrc stri
|
|||
generateCaptions := updateCaptions && m.ShouldGenerateCaption(customSrc, force)
|
||||
detectNsfw := updateNsfw && (!photo.PhotoPrivate || force)
|
||||
|
||||
if !(generateLabels || generateCaptions || detectNsfw || detectFaces) {
|
||||
if !generateLabels && !generateCaptions && !detectNsfw && !detectFaces {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue