Overhaul publicreport storage layer, create unified tables
This is a huge change. I was getting really sick of the split between nuisance/water tables when more than half of the data they store is common. I finally bit off the big work of switching it all. This creates a single unified table, publicreport.report and copies the existing report data into it. It also ports existing data from the original tables into the new table. Along with all of this I also overhauled the system for handling asynchronous work to use a LISTEN/NOTIFY connection from the database and a single cache table to avoid ever losing work.
This commit is contained in:
parent
2538638c9d
commit
1e071d5ce5
109 changed files with 22903 additions and 11713 deletions
|
|
@ -3,6 +3,7 @@ package background
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/Gleipnir-Technology/bob"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
||||
|
|
@ -26,11 +27,15 @@ func NewEmailSend(ctx context.Context, txn bob.Executor, email_id int32) error {
|
|||
func NewLabelStudioAudioCreate(ctx context.Context, txn bob.Executor, note_audio_id int32) error {
|
||||
return newJob(ctx, txn, enums.JobtypeLabelStudioAudioCreate, note_audio_id)
|
||||
}
|
||||
func NewTextSend(ctx context.Context, txn bob.Executor, text_id int32) error {
|
||||
return newJob(ctx, txn, enums.JobtypeTextSend, text_id)
|
||||
func NewTextRespond(ctx context.Context, txn bob.Executor, text_id int32) error {
|
||||
return newJob(ctx, txn, enums.JobtypeTextRespond, text_id)
|
||||
}
|
||||
func NewTextSend(ctx context.Context, txn bob.Executor, job_id int32) error {
|
||||
return newJob(ctx, txn, enums.JobtypeTextSend, job_id)
|
||||
}
|
||||
func newJob(ctx context.Context, txn bob.Executor, t enums.Jobtype, id int32) error {
|
||||
_, err := models.Jobs.Insert(&models.JobSetter{
|
||||
Created: omit.From(time.Now()),
|
||||
// ID
|
||||
Type: omit.From(t),
|
||||
RowID: omit.From(id),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue