Skip to content

Commit bc7e943

Browse files
committed
mutex function
1 parent b87622c commit bc7e943

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/resourcemanager/delegate.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
"strconv"
3333
"strings"
3434

35-
//"sync"
35+
"sync"
3636
"time"
3737

3838
"github.com/grycap/oscar/v3/pkg/types"
@@ -47,7 +47,7 @@ const (
4747
// tokenCache map to store tokens from services and endpoints -> [CLUSTER_ENDPOINT][SERVICE_NAME]
4848
var tokenCache = map[string]map[string]string{}
4949

50-
//var mutex sync.Mutex
50+
var mutex sync.Mutex
5151

5252
// DelegatedEvent wraps the original input event by adding the storage provider ID
5353
type DelegatedEvent struct {
@@ -259,8 +259,8 @@ func reorganizeIfNearby(alternatives []Alternative, distances []float64, thresho
259259
func DelegateJob(service *types.Service, event string, logger *log.Logger) error {
260260

261261
//Block access before executing the function
262-
//mutex.Lock()
263-
//defer mutex.Unlock()
262+
mutex.Lock()
263+
defer mutex.Unlock()
264264

265265
//Determine priority level of each replica to delegate
266266
if service.Delegation == "topsis" {

0 commit comments

Comments
 (0)