fix: prevent running multiple times at once

This commit is contained in:
Gabe Farrell 2025-12-17 20:00:03 -05:00
parent 8682925f2b
commit 6beb12a73d

View file

@ -148,6 +148,15 @@ func RunImporter() {
importDir := os.Getenv("IMPORT_DIR")
libraryDir := os.Getenv("LIBRARY_DIR")
importerMu.Lock()
importerRunning = true
importerMu.Unlock()
defer func() {
importerMu.Lock()
importerRunning = false
importerMu.Unlock()
}()
if importDir == "" || libraryDir == "" {
log.Println("IMPORT_DIR and LIBRARY_DIR must be set")
return