Skip to content

Commit

Permalink
add failover ctx mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek9686 committed Nov 22, 2024
1 parent d7881c9 commit 6f60551
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pro/logic/failover.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package logic
import (
"errors"
"net"
"sync"

"github.com/google/uuid"
"github.com/gravitl/netmaker/logger"
Expand All @@ -11,8 +12,11 @@ import (
"golang.org/x/exp/slog"
)

func SetFailOverCtx(failOverNode, victimNode, peerNode models.Node) error {
var failOverCtxMutex = &sync.RWMutex{}

func SetFailOverCtx(failOverNode, victimNode, peerNode models.Node) error {
failOverCtxMutex.Lock()
defer failOverCtxMutex.Unlock()
if peerNode.FailOverPeers == nil {
peerNode.FailOverPeers = make(map[string]struct{})
}
Expand Down

0 comments on commit 6f60551

Please sign in to comment.