From 739419a3aa93a181fe49c0fd824037bd4bfe6d5c Mon Sep 17 00:00:00 2001 From: Meisterlala <6453306+Meisterlala@users.noreply.github.com> Date: Tue, 28 Oct 2025 22:33:06 +0100 Subject: [PATCH] fixed infinite run --- PKGBUILD | 2 +- cmd/compressor/main.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/PKGBUILD b/PKGBUILD index 9e6ceab..1b109ce 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Misti pkgname=compressor-git -pkgver=r15.acc0888 +pkgver=r16.0a9cb23 pkgrel=1 pkgdesc="Video compressor service that watches input directory and compresses videos using ffmpeg" arch=('x86_64' 'aarch64') diff --git a/cmd/compressor/main.go b/cmd/compressor/main.go index f0f53ce..b23acda 100644 --- a/cmd/compressor/main.go +++ b/cmd/compressor/main.go @@ -123,7 +123,9 @@ func main() { log.Fatalf("watch dir: %v", err) } + wg.Add(1) go func() { + defer wg.Done() for { select { case <-ctx.Done(): @@ -144,7 +146,9 @@ func main() { } }() + wg.Add(1) go func() { + defer wg.Done() ticker := time.NewTicker(cfg.rescanInterval) defer ticker.Stop() for { @@ -161,14 +165,18 @@ func main() { serverErrs := make(chan error, 1) if cfg.httpPort != "" { + wg.Add(1) go func() { + defer wg.Done() serverErrs <- runHTTPServer(ctx, cfg.httpPort) }() } else { close(serverErrs) } + log.Println("Startup Done") <-ctx.Done() + log.Println("Shutting down...") dispatcherCancel() wg.Wait() -- 2.51.2