feat(11-01): run job workers in serve and queue:work, add queue:clear
- Manager gains the apparatus JobManager surface: StartJob, UpdateJobState, UpdateMetadata, FailJob, CancelJob (is_canceled + STOPPED + River JobCancel), StopJob (STOPPED only), CheckIfCanceled and GetMetadata, all raw column writes so updated_at is untouched - serve starts the in-process worker unless queue.work_in_serve is false and stops it on shutdown; an app without jobs gets an idle worker - queue:work runs a foreground worker with repeatable --queue filters; queue:clear deletes available, scheduled and retryable jobs of one queue - the generated main appends conga.RuntimeCommands; summer delegates queue:work and queue:clear; make:job scaffolds a conga.Job
This commit is contained in:
@@ -43,6 +43,26 @@ func delegateRollbackCommand() bonfire.Command {
|
||||
}
|
||||
}
|
||||
|
||||
func delegateQueueWorkCommand() bonfire.Command {
|
||||
return bonfire.Command{
|
||||
Name: "queue:work",
|
||||
Description: "Run background job workers in the app binary",
|
||||
Flags: []bonfire.Flag{{
|
||||
Name: "queue",
|
||||
Description: "Queue to work (repeatable; default all known queues)",
|
||||
Repeatable: true,
|
||||
}},
|
||||
Run: func(ctx context.Context, in bonfire.Input, out bonfire.Output) error {
|
||||
argv := []string{"queue:work"}
|
||||
for _, q := range in.Flags("queue") {
|
||||
argv = append(argv, "--queue", q)
|
||||
}
|
||||
argv = append(argv, in.Args()...)
|
||||
return runAppBinary(ctx, argv, out)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func runAppBinary(ctx context.Context, argv []string, out bonfire.Output) error {
|
||||
if len(argv) == 0 {
|
||||
return fmt.Errorf("summer: missing app command")
|
||||
|
||||
Reference in New Issue
Block a user