Move comms work to background goroutine

This is a sort of random checkpoint of work
 * add schema for tracking messages sent to DB
 * add terms of service and privacy policy for RCS compliance
 * standardize some things about background workers
 * update some missing stuff from generated DB code
This commit is contained in:
Eli Ribble 2026-01-20 17:10:22 +00:00
parent 8f44e57c72
commit 842e6cff43
No known key found for this signature in database
47 changed files with 7361 additions and 179 deletions

16
main.go
View file

@ -65,6 +65,9 @@ func main() {
defer cancel()
background.NewOAuthTokenChannel = make(chan struct{}, 10)
queue.ChannelJobAudio = make(chan queue.JobAudio, 100) // Buffered channel to prevent blocking
queue.ChannelJobEmail = make(chan queue.JobEmail, 100) // Buffered channel to prevent blocking
queue.ChannelJobSMS = make(chan queue.JobSMS, 100) // Buffered channel to prevent blocking
var waitGroup sync.WaitGroup
@ -77,9 +80,20 @@ func main() {
waitGroup.Add(1)
go func() {
defer waitGroup.Done()
queue.StartAudioWorker(ctx)
background.StartWorkerAudio(ctx, queue.ChannelJobAudio)
}()
waitGroup.Add(1)
go func() {
defer waitGroup.Done()
background.StartWorkerEmail(ctx, queue.ChannelJobEmail)
}()
waitGroup.Add(1)
go func() {
defer waitGroup.Done()
background.StartWorkerSMS(ctx, queue.ChannelJobSMS)
}()
server := &http.Server{
Addr: config.Bind,
Handler: r,