Skip to content

Commit

Permalink
Static sleep.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Jun 27, 2024
1 parent ae9c5f2 commit e6a1e73
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sources/dynamodb/shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ func (s *StreamStore) processShard(ctx context.Context, shard *dynamodbstreams.S

if shard.ParentShardId != nil {
parentID := *shard.ParentShardId
if !s.storage.GetShardProcessed(parentID) && s.storage.GetShardProcessing(parentID) {
slog.Info("Parent shard is being processed, let's sleep and retry", slog.String("shardId", *shard.ShardId))

time.Sleep(jitter.Jitter(500, jitter.DefaultMaxMs, 0))
if s.storage.GetShardProcessing(parentID) && !s.storage.GetShardProcessed(parentID) {
slog.Info("Parent shard is being processed, let's sleep 3s and retry", slog.String("shardId", *shard.ShardId))
time.Sleep(3 * time.Second)
s.processShard(ctx, shard, writer)
return
}
Expand Down

0 comments on commit e6a1e73

Please sign in to comment.