Create generic backend process, fix background interdependencies

This refactor was born out of the inter-dependency cycles developing
between the "background" module and just about every other module which
was caused by the background module becoming a dependency of every
module that needed to background work and the fact that the background
module was also supposedly responsible for the logic for processing
those tasks.

Instead the "background" module is now very, very shallow and relies
entirely on the Postgres NOTIFY logic for triggering jobs. There's a new
table, `job` which holds just a type and single row ID.

All told, this means that jobs can be added to the queue as part of the
API-level or platform-level transaction, ensuring atomicity, and
processing coordination is handled by the platform module, which can
depend on anything.
This commit is contained in:
Eli Ribble 2026-03-16 19:52:29 +00:00
parent 3a28151b09
commit 2538638c9d
No known key found for this signature in database
47 changed files with 1553 additions and 1054 deletions

17
db/dberrors/job.bob.go Normal file
View file

@ -0,0 +1,17 @@
// Code generated by BobGen psql v0.42.5. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package dberrors
var JobErrors = &jobErrors{
ErrUniqueJobPkey: &UniqueConstraintError{
schema: "",
table: "job",
columns: []string{"id"},
s: "job_pkey",
},
}
type jobErrors struct {
ErrUniqueJobPkey *UniqueConstraintError
}

View file

@ -10,8 +10,17 @@ var NoteAudioErrors = &noteAudioErrors{
columns: []string{"version", "uuid"},
s: "note_audio_pkey",
},
ErrUniqueNoteAudioIdUnique: &UniqueConstraintError{
schema: "",
table: "note_audio",
columns: []string{"id"},
s: "note_audio_id_unique",
},
}
type noteAudioErrors struct {
ErrUniqueNoteAudioPkey *UniqueConstraintError
ErrUniqueNoteAudioIdUnique *UniqueConstraintError
}