From eeef4f02de198d1c10c2775010597d783e9cb64a Mon Sep 17 00:00:00 2001 From: elinuxhenrik Date: Tue, 8 Nov 2022 14:57:58 +0100 Subject: [PATCH] Add missing locks Issue-ID: NONRTRIC-814 Signed-off-by: elinuxhenrik Change-Id: I8e637dd5356923ddc6dfe7a4c0401c46da5e2a6e --- capifcore/internal/providermanagement/providermanagement.go | 3 +++ capifcore/internal/publishservice/publishservice.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/capifcore/internal/providermanagement/providermanagement.go b/capifcore/internal/providermanagement/providermanagement.go index 82d833f..b957961 100644 --- a/capifcore/internal/providermanagement/providermanagement.go +++ b/capifcore/internal/providermanagement/providermanagement.go @@ -121,6 +121,9 @@ func (pm *ProviderManager) PutRegistrationsRegistrationId(ctx echo.Context, regi return sendCoreError(ctx, http.StatusBadRequest, "Invalid format for provider") } + pm.lock.Lock() + defer pm.lock.Unlock() + for _, function := range *updatedProvider.ApiProvFuncs { if function.ApiProvFuncId == nil { function.ApiProvFuncId = pm.getFuncId(function.ApiProvFuncRole, function.ApiProvFuncInfo) diff --git a/capifcore/internal/publishservice/publishservice.go b/capifcore/internal/publishservice/publishservice.go index eda6af2..43cdb8d 100644 --- a/capifcore/internal/publishservice/publishservice.go +++ b/capifcore/internal/publishservice/publishservice.go @@ -182,6 +182,8 @@ func (ps *PublishService) DeleteApfIdServiceApisServiceApiId(ctx echo.Context, a ps.helmManager.UninstallHelmChart(info[1], info[3]) log.Info("Deleted service: ", serviceApiId) } + ps.lock.Lock() + defer ps.lock.Unlock() delete(ps.publishedServices, string(serviceApiId)) } return ctx.NoContent(http.StatusNoContent) -- 2.16.6