1247
1248
// update lastUpdate here so that we don't have to grab shard lock again if UpdateShard is successful
1250
>
prevTasksCompletedSinceLastUpdate := s.tasksCompletedSinceLastUpdate
1251
>
metrics.TasksCompletedPerShardInfoUpdate.With(s.metricsHandler).Record(int64(s.tasksCompletedSinceLastUpdate))
1252
>
metrics.TimeBetweenShardInfoUpdates.With(s.metricsHandler).Record(now.Sub(previousLastUpdate))
1253
>
1254
>
s.lastUpdated = now
1255
>
s.tasksCompletedSinceLastUpdate = 0
1256
>
1257
>
updatedShardInfo := trimShardInfo(s.config, s.clusterMetadata.GetAllClusterInfo(), s.copyShardInfo(s.shardInfo))
1258
>
request := &persistence.UpdateShardRequest{
1259
>
ShardInfo: updatedShardInfo,
1260
>
PreviousRangeID: s.shardInfo.GetRangeId(),
1261
>
}
1262
>
s.wUnlock()
1263
>
1264
>
if err := s.ioSemaphoreAcquire(s.lifecycleCtx); err != nil {
1265
return err
1266
}
1268
>
1269
>
ctx, cancel := s.newIOContext()
1270
>
defer cancel()
1271
>
1272
>
err := s.persistenceShardManager.UpdateShard(ctx, request)
1273
>
if err != nil {
1274
s.wLock()
1275
defer s.wUnlock()