mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-24 19:26:39 +00:00
fix peer add if group not existing
This commit is contained in:
@@ -1827,16 +1827,16 @@ func (s *SqlStore) SaveGroup(ctx context.Context, lockStrength LockingStrength,
|
||||
|
||||
group.StoreGroupPeers()
|
||||
|
||||
if err := s.db.Model(group).Association("GroupPeers").Replace(group.GroupPeers); err != nil {
|
||||
log.WithContext(ctx).Errorf("failed to replace peers for group %s: %v", group.ID, err)
|
||||
return status.Errorf(status.Internal, "failed to sync group peers")
|
||||
}
|
||||
|
||||
if err := s.db.Save(group).Error; err != nil {
|
||||
log.WithContext(ctx).Errorf("failed to save group to store: %v", err)
|
||||
return status.Errorf(status.Internal, "failed to save group to store")
|
||||
}
|
||||
|
||||
if err := s.db.Model(group).Association("GroupPeers").Replace(group.GroupPeers); err != nil {
|
||||
log.WithContext(ctx).Errorf("failed to replace peers for group %s: %v", group.ID, err)
|
||||
return status.Errorf(status.Internal, "failed to sync group peers")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user