Skip to content

Commit

Permalink
mutex function
Browse files Browse the repository at this point in the history
  • Loading branch information
vicente87 committed Dec 10, 2024
1 parent b87622c commit bc7e943
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/resourcemanager/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"strconv"
"strings"

//"sync"
"sync"
"time"

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

//var mutex sync.Mutex
var mutex sync.Mutex

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

//Block access before executing the function
//mutex.Lock()
//defer mutex.Unlock()
mutex.Lock()
defer mutex.Unlock()

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

0 comments on commit bc7e943

Please sign in to comment.