created utils file to better organize code

This commit is contained in:
pippellia-btc
2025-09-14 12:53:26 +02:00
parent ba6e9eeb33
commit c7e4ff79c1
3 changed files with 42 additions and 37 deletions

View File

@@ -4,10 +4,7 @@ import (
"context"
"fmt"
"log"
"os"
"os/signal"
"sync/atomic"
"syscall"
"time"
"github.com/vertex-lab/crawler_v2/pkg/graph"
@@ -214,13 +211,3 @@ func Promote(db redb.RedisDB, node graph.ID) error {
return db.Promote(ctx, node)
}
// HandleSignals listens for OS signals and triggers context cancellation.
func HandleSignals(cancel context.CancelFunc) {
signals := make(chan os.Signal, 1)
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM)
<-signals
log.Println("signal received. shutting down...")
cancel()
}