package main

import (
	"context"
	"log"
	"os"
	"os/signal"
	"syscall"

	"fetcher/internal/scheduler"
	"fetcher/jobs"
)

func main() {
	ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
	defer stop()

	logger := log.New(os.Stdout, "[scheduler] ", log.LstdFlags)
	runner := scheduler.New(logger)

	logger.Println("starting job runner (ctrl+c to exit)")
	runner.Run(ctx, jobs.All())
	logger.Println("job runner stopped")
}
