nidus-sync/background/background.go
Eli Ribble 196792810b
Overhaul email sending system
Add logging and saving templates to the database for historical
accuracy.
2026-01-23 20:36:16 +00:00

46 lines
942 B
Go

package background
import (
"context"
"sync"
"github.com/Gleipnir-Technology/nidus-sync/comms/email"
)
var waitGroup sync.WaitGroup
func Start(ctx context.Context) {
newOAuthTokenChannel = make(chan struct{}, 10)
channelJobAudio = make(chan jobAudio, 100) // Buffered channel to prevent blocking
channelJobEmail = make(chan email.Job, 100) // Buffered channel to prevent blocking
channelJobText = make(chan jobText, 100) // Buffered channel to prevent blocking
waitGroup.Add(1)
go func() {
defer waitGroup.Done()
refreshFieldseekerData(ctx, newOAuthTokenChannel)
}()
waitGroup.Add(1)
go func() {
defer waitGroup.Done()
startWorkerAudio(ctx, channelJobAudio)
}()
waitGroup.Add(1)
go func() {
defer waitGroup.Done()
startWorkerEmail(ctx, channelJobEmail)
}()
waitGroup.Add(1)
go func() {
defer waitGroup.Done()
startWorkerText(ctx, channelJobText)
}()
}
func WaitForExit() {
waitGroup.Wait()
}