@@ -248,21 +248,21 @@ func (dr *DeploymentReplication) inspectIncomingSynchronizationStatus(destStatus
248
248
249
249
var totalShardsFromStatus , shardsInSync int
250
250
dbs := make (map [string ]api.DatabaseSynchronizationStatus , 0 )
251
- for _ , s := range destStatus .Shards {
252
- db := dbs [s .Database ]
251
+ for _ , shard := range destStatus .Shards {
252
+ db := dbs [shard .Database ]
253
253
db .ShardsTotal ++
254
254
totalShardsFromStatus ++
255
- if s .Status == client .SyncStatusRunning {
255
+ if shard .Status == client .SyncStatusRunning {
256
256
db .ShardsInSync ++
257
257
shardsInSync ++
258
- } else if s .Status == client .SyncStatusFailed && len (db .Errors ) < maxReportedIncomingSyncErrorsPerDatabase {
258
+ } else if shard .Status == client .SyncStatusFailed && len (db .Errors ) < maxReportedIncomingSyncErrorsPerDatabase {
259
259
db .Errors = append (db .Errors , api.DatabaseSynchronizationError {
260
- Collection : s .Collection ,
261
- Shard : strconv .Itoa (s .ShardIndex ),
262
- Message : fmt .Sprintf ("shard sync failed: %s" , s .StatusMessage ),
260
+ Collection : shard .Collection ,
261
+ Shard : strconv .Itoa (shard .ShardIndex ),
262
+ Message : fmt .Sprintf ("shard sync failed: %s" , shard .StatusMessage ),
263
263
})
264
264
}
265
- dbs [s .Database ] = db
265
+ dbs [shard .Database ] = db
266
266
}
267
267
268
268
var totalShards = destStatus .TotalShardsCount
@@ -276,7 +276,7 @@ func (dr *DeploymentReplication) inspectIncomingSynchronizationStatus(destStatus
276
276
}
277
277
return api.SynchronizationStatus {
278
278
Progress : progress ,
279
- AllInSync : destStatus .Status == client .SyncStatusRunning ,
279
+ AllInSync : destStatus .Status == client .SyncStatusRunning && shardsInSync == totalShards ,
280
280
Databases : dbs ,
281
281
Error : "" ,
282
282
}
0 commit comments