mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2025-08-24 11:35:19 +02:00
bugfix-node-not-leaving
- Add lock when perform synchronisation on concurrent access
This commit is contained in:
@@ -28,6 +28,7 @@ type SyncerImpl struct {
|
||||
cluster conn.ConnCluster
|
||||
conf *conf.DaemonConfiguration
|
||||
lastSync map[string]int64
|
||||
lock sync.RWMutex
|
||||
}
|
||||
|
||||
// Sync: Sync with random nodes
|
||||
@@ -134,7 +135,9 @@ func (s *SyncerImpl) Sync(correspondingMesh mesh.MeshProvider) error {
|
||||
|
||||
correspondingMesh.SaveChanges()
|
||||
|
||||
s.lock.Lock()
|
||||
s.lastSync[correspondingMesh.GetMeshId()] = time.Now().Unix()
|
||||
s.lock.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user