Skip to content

Commit

Permalink
fix: skip the sync peer that does not belong to the scheduler cluster (
Browse files Browse the repository at this point in the history
…#3731)

Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi authored Dec 27, 2024
1 parent cc235df commit f945894
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion manager/job/sync_peers.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import (
resource "d7y.io/dragonfly/v2/scheduler/resource/standard"
)

// SyncPeers is an interface for sync peers.
// SyncPeers is an interface for sync peers. It is only supported in Rust client,
// refer to https://github.com/dragonflyoss/client.
type SyncPeers interface {
// CreateSyncPeers creates sync peers job, and merge the sync peer results with the data
// in the peer table in the database. It is a synchronous operation, and it will returns
Expand Down Expand Up @@ -195,6 +196,13 @@ func (s *syncPeers) mergePeers(ctx context.Context, scheduler models.Scheduler,
// Convert sync peer results from slice to map.
syncPeers := make(map[string]*resource.Host, len(results))
for _, result := range results {
// Skip the sync peer that does not belong to the scheduler cluster,
// it is only supported in Rust client. The golang client lacks the
// SchedulerClusterID field.
if result.SchedulerClusterID == 0 {
continue
}

syncPeers[result.ID] = result
}

Expand Down

0 comments on commit f945894

Please sign in to comment.