bouncer/internal/setup/lock.go
William Petit 83fcb9a39d
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good
feat: add limited retry mechanism to prevent startup error if redis is not ready
2024-04-05 10:30:34 +02:00

16 lines
409 B
Go

package setup
import (
"context"
"forge.cadoles.com/cadoles/bouncer/internal/config"
"forge.cadoles.com/cadoles/bouncer/internal/lock"
"forge.cadoles.com/cadoles/bouncer/internal/lock/redis"
)
func SetupLocker(ctx context.Context, conf *config.Config) (lock.Locker, error) {
client := newRedisClient(conf.Redis)
locker := redis.NewLocker(client, int(conf.Redis.LockMaxRetries))
return locker, nil
}