fix: (redis) bootstrap connection struct properly

This commit is contained in:
Mohamed Sohail 2022-05-05 19:39:25 +03:00
parent da66f70bf9
commit a68ae5a9eb
Signed by: kamikazechaser
GPG Key ID: 7DD45520C01CD85D
3 changed files with 8 additions and 4 deletions

View File

@ -47,13 +47,17 @@ func loadConfig(configFilePath string, k *koanf.Koanf) error {
return nil
}
func connectDb(dsn string) error {
func connectDbs(dsn string) error {
var err error
db, err = pgxpool.Connect(context.Background(), dsn)
if err != nil {
return err
}
rClient = asynq.RedisClientOpt{
Addr: conf.Db.Redis,
}
return nil
}

View File

@ -35,7 +35,7 @@ func init() {
log.Fatal().Err(err).Msg("failed to load sql file")
}
if err := connectDb(conf.Db.Postgres); err != nil {
if err := connectDbs(conf.Db.Postgres); err != nil {
log.Fatal().Err(err).Msg("failed to connect to postgres")
}

View File

@ -8,5 +8,5 @@ rpc = "http://127.0.0.1:8545"
[syncers]
cache = "@every 20s"
ussd = "@every 1m"
token = "@every 10s"
ussd = "@every 30"
token = "@every 1m"