lab2 fix
Application / Lint (pull_request) Canceled after 0s
Application / Unit tests (pull_request) Canceled after 0s
Application / Docker build (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
Vladislav Kunetskiy
2026-10-10 00:50:24 +03:00
parent 1e38dbdf35
commit da9fcf346a
36 changed files with 995 additions and 1038 deletions
+2 -18
View File
@@ -70,18 +70,10 @@ func run(cfg config.Config, log *slog.Logger) error {
pingers := []health.Pinger{store}
if cfg.Redis.Enabled {
sessionRepo = storageredis.NewSessionRepository(
store.Sessions(),
redisCache,
cfg.Cache.SessionTTL,
log,
)
if cfg.Cache.Enabled {
distributed, err := cache.NewDistributed(redisCache, cache.DistributedConfig{
LockTTL: cfg.Cache.LockTTL,
WaitTimeout: cfg.Cache.LockWaitTimeout,
TimeoutPolicy: timeoutPolicy(cfg.Cache.LockTimeoutPolicy),
LockTTL: cfg.Cache.LockTTL,
WaitTimeout: cfg.Cache.LockWaitTimeout,
}, log)
if err != nil {
return fmt.Errorf("build distributed cache: %w", err)
@@ -180,11 +172,3 @@ func connectRedis(cfg config.Redis) (cache.LockStore, error) {
return client, nil
}
func timeoutPolicy(value string) cache.TimeoutPolicy {
if value == "load" {
return cache.TimeoutLoad
}
return cache.TimeoutError
}