ActivityFetcher/jobs/example_job.go
2025-10-14 10:45:43 +02:00

30 lines
593 B
Go

package jobs
import (
"context"
"fmt"
"time"
)
const exampleInterval = 5 * time.Second
func init() {
Register(&ExampleJob{})
}
// ExampleJob prints a timestamp on each run to demonstrate scheduling.
type ExampleJob struct{}
func (ExampleJob) Name() string {
return "example_job"
}
// Interval returns how often the job should run. Defined in this file per requirements.
func (ExampleJob) Interval() time.Duration {
return exampleInterval
}
func (ExampleJob) Run(ctx context.Context) error {
fmt.Printf("[%s] running example job\n", time.Now().Format(time.RFC3339))
return nil
}