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:
@@ -128,6 +128,20 @@ func TestGenerateMainRegistersCabanaRuntimeCommands(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateMainRegistersCongaRuntimeCommands(t *testing.T) {
|
||||
mainSrc, err := generateMain(Manifest{Module: "example.com/app", Binary: "hello"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
line := []byte("commands = append(commands, conga.RuntimeCommands(app, plugins)...)")
|
||||
if n := bytes.Count(mainSrc, line); n != 1 {
|
||||
t.Fatalf("conga.RuntimeCommands line count = %d, want 1\n%s", n, mainSrc)
|
||||
}
|
||||
if !bytes.Contains(mainSrc, []byte(`"git.golem15.com/golem15/summercms/modules/conga"`)) {
|
||||
t.Fatalf("generated main does not import conga:\n%s", mainSrc)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriteIfChangedSkipsIdenticalBytes(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
path := filepath.Join(dir, "out.go")
|
||||
@@ -696,9 +710,9 @@ func TestScaffoldAllArtifacts(t *testing.T) {
|
||||
for _, want := range []string{
|
||||
"func (ReindexArgs) Kind()",
|
||||
`Kind() string { return "golem15.demo.reindex" }`,
|
||||
"func (reindexJob) Work(",
|
||||
"unexpected args type",
|
||||
"func ReindexJob()",
|
||||
"func ReindexJob() pact.Job",
|
||||
"conga.Job(func(ctx context.Context, args ReindexArgs) error",
|
||||
`"git.golem15.com/golem15/summercms/modules/conga"`,
|
||||
} {
|
||||
if !bytes.Contains(jobSrc, []byte(want)) {
|
||||
t.Fatalf("job.go missing %s:\n%s", want, jobSrc)
|
||||
|
||||
Reference in New Issue
Block a user