cic-dw/cmd/processor.go
Mohammed Sohail 1c65a11460
add: ussd and cache syncer tasks
- no repeat on failure, picked up on next schedule
- enforce uniq on users and tx table to prevent duplicates
2022-05-03 21:37:48 +03:00

25 lines
493 B
Go

package main
import (
"github.com/hibiken/asynq"
"github.com/rs/zerolog/log"
)
func runProcessor(app *App) {
processorServer := asynq.NewServer(
app.rClient,
asynq.Config{
Concurrency: 10,
},
)
mux := asynq.NewServeMux()
mux.Handle("token:sync", newTokenSyncer(app))
mux.Handle("cache:sync", newCacheSyncer(app))
mux.Handle("ussd:sync", newUssdSyncer(app))
if err := processorServer.Run(mux); err != nil {
log.Fatal().Err(err).Msg("failed to start job processor")
}
}