@@ -248,21 +248,21 @@ func (dr *DeploymentReplication) inspectIncomingSynchronizationStatus(destStatus
248248
249249 var totalShardsFromStatus , shardsInSync int
250250 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 ]
253253 db .ShardsTotal ++
254254 totalShardsFromStatus ++
255- if s .Status == client .SyncStatusRunning {
255+ if shard .Status == client .SyncStatusRunning {
256256 db .ShardsInSync ++
257257 shardsInSync ++
258- } else if s .Status == client .SyncStatusFailed && len (db .Errors ) < maxReportedIncomingSyncErrorsPerDatabase {
258+ } else if shard .Status == client .SyncStatusFailed && len (db .Errors ) < maxReportedIncomingSyncErrorsPerDatabase {
259259 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 ),
263263 })
264264 }
265- dbs [s .Database ] = db
265+ dbs [shard .Database ] = db
266266 }
267267
268268 var totalShards = destStatus .TotalShardsCount
@@ -276,7 +276,7 @@ func (dr *DeploymentReplication) inspectIncomingSynchronizationStatus(destStatus
276276 }
277277 return api.SynchronizationStatus {
278278 Progress : progress ,
279- AllInSync : destStatus .Status == client .SyncStatusRunning ,
279+ AllInSync : destStatus .Status == client .SyncStatusRunning && shardsInSync == totalShards ,
280280 Databases : dbs ,
281281 Error : "" ,
282282 }
0 commit comments