diff --git a/lib/benchmark/append_non_conflicting_tags.rb b/lib/benchmark/append_non_conflicting_tags.rb index 038cff4..a8c80de 100644 --- a/lib/benchmark/append_non_conflicting_tags.rb +++ b/lib/benchmark/append_non_conflicting_tags.rb @@ -22,12 +22,13 @@ module En57 .with_tag(tags = ["writer:#{run_id}"]) events = @batch_size.times.map { Event.new(type:, tags:) } + position = 0 measure.call do loop do - case @event_store.append(events, fail_if: scope.after(position = 0)) + case @event_store.append(events, fail_if: scope.after(position)) in Success break - in Failure + in Failure(position:) retries.call end end diff --git a/lib/benchmark/concurrent_append_conflicting_tags.rb b/lib/benchmark/concurrent_append_conflicting_tags.rb index 8e610fe..25f4077 100644 --- a/lib/benchmark/concurrent_append_conflicting_tags.rb +++ b/lib/benchmark/concurrent_append_conflicting_tags.rb @@ -23,19 +23,14 @@ module En57 events = @batch_size.times.map { Event.new(type:, tags:) } barrier.wait + position = 0 measure.call do loop do - case @event_store.append( - events, - fail_if: scope.after(position = 0), - ) + case @event_store.append(events, fail_if: scope.after(position)) in Success break - in Failure + in Failure(position:) retries.call - scope.each_with_position do |_event, event_position| - position = event_position - end end end end diff --git a/lib/benchmark/concurrent_append_non_conflicting_tags.rb b/lib/benchmark/concurrent_append_non_conflicting_tags.rb index 54c94be..e6727d8 100644 --- a/lib/benchmark/concurrent_append_non_conflicting_tags.rb +++ b/lib/benchmark/concurrent_append_non_conflicting_tags.rb @@ -27,15 +27,13 @@ module En57 events = @batch_size.times.map { Event.new(type:, tags:) } barrier.wait + position = 0 measure.call do loop do - case @event_store.append( - events, - fail_if: scope.after(position = 0), - ) + case @event_store.append(events, fail_if: scope.after(position)) in Success break - in Failure + in Failure(position:) retries.call end end