From 6beb12a73d9ad59bf0d16eab335d3e95ec7ee3cc Mon Sep 17 00:00:00 2001 From: Gabe Farrell Date: Wed, 17 Dec 2025 20:00:03 -0500 Subject: [PATCH] fix: prevent running multiple times at once --- main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.go b/main.go index 27747ad..012f775 100644 --- a/main.go +++ b/main.go @@ -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