From 21e7aa1222398d64606145bfafa4f88fa11c0563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Jerman?= Date: Fri, 20 Sep 2019 09:22:06 +0200 Subject: [PATCH] Fix mutexes --- internal/permissions/service.go | 3 ++- pkg/automation/service.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/permissions/service.go b/internal/permissions/service.go index 855f2c2d3..c6e13fe63 100644 --- a/internal/permissions/service.go +++ b/internal/permissions/service.go @@ -14,7 +14,7 @@ import ( type ( service struct { - l sync.Mutex + l *sync.Mutex logger *zap.Logger // service will flush values on TRUE or just reload on FALSE @@ -35,6 +35,7 @@ const ( // It acts as a caching layer func Service(ctx context.Context, logger *zap.Logger, repository *repository) (svc *service) { svc = &service{ + l: &sync.Mutex{}, f: make(chan bool), logger: logger.Named("permissions"), diff --git a/pkg/automation/service.go b/pkg/automation/service.go index 4b64aab60..b53eb2862 100644 --- a/pkg/automation/service.go +++ b/pkg/automation/service.go @@ -15,7 +15,7 @@ import ( type ( service struct { - l sync.Mutex + l *sync.Mutex logger *zap.Logger c AutomationServiceConfig @@ -70,6 +70,7 @@ func Service(c AutomationServiceConfig) (svc *service) { logger: c.Logger.Named("automation"), c: c, + l: &sync.Mutex{}, makeToken: c.TokenMaker,