This repository was archived by the owner on Aug 29, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +1
-7
lines changed Expand file tree Collapse file tree 2 files changed +1
-7
lines changed Original file line number Diff line number Diff line change @@ -10,16 +10,13 @@ import (
1010 "github.com/sheenazien8/goplate/pkg/models"
1111)
1212
13- // Task defines the work to be processed by the queue
1413type Task func ()
1514
16- // Queue represents a simple in-memory task queue with worker pool
1715type Queue struct {
1816 tasks chan Task
1917 wg sync.WaitGroup
2018}
2119
22- // New creates a new Queue with the specified buffer size
2320func New (bufferSize int ) * Queue {
2421 return & Queue {
2522 tasks : make (chan Task , bufferSize ),
@@ -93,17 +90,14 @@ func ptr[T any](v T) *T {
9390 return & v
9491}
9592
96- // Registry maps job type string to a function that builds and returns a Job
9793var registry = map [string ]func () Job {}
9894
99- // RegisterJob registers a job handler with a type string
10095func RegisterJob (job Job ) {
10196 registry [job .Type ()] = func () Job {
10297 return job
10398 }
10499}
105100
106- // ResolveJob looks up and creates a job instance from type
107101func ResolveJob (typeName string , payload json.RawMessage ) (Job , error ) {
108102 creator , exists := registry [typeName ]
109103 if ! exists {
Original file line number Diff line number Diff line change @@ -43,6 +43,6 @@ func (s *Scheduler) Stop() context.Context {
4343
4444var SchedulerRegistry = map [string ]func () (spec string , task func ()){}
4545
46- func registerScheduler (name string , scheduler func () (spec string , task func ())) {
46+ func RegisterScheduler (name string , scheduler func () (spec string , task func ())) {
4747 SchedulerRegistry [name ] = scheduler
4848}
You can’t perform that action at this time.
0 commit comments