Skip to content

Conversation

@Aaronontheweb
Copy link
Member

@Aaronontheweb Aaronontheweb commented Mar 19, 2025

Changes

Fix #7529, Fix #7530: Fix ShardingProducerController and RetryTimer issues

This commit addresses two issues in the Akka.Cluster.Sharding.Delivery module:

  1. Fixes type mismatch in ShardingProducerController where AskNextTo was returning Done.Instance instead of the expected sequence number
  2. Fixes RetryTimer not properly incrementing intervals by storing the new interval value before starting the timer

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

Fix akkadotnet#7529, Fix akkadotnet#7530: Fix ShardingProducerController and RetryTimer issues

- Fix akkadotnet#7529: Update ShardingProducerController to return sequence numbers
  instead of Done.Instance in AskNextTo responses to match Task<long> return type
- Fix akkadotnet#7530: Properly store and increment RetryTimer interval in ScheduleNext()
  method to enable exponential backoff

This commit addresses two issues in the Akka.Cluster.Sharding.Delivery module:
1. Fixes type mismatch in ShardingProducerController where AskNextTo was
   returning Done.Instance instead of the expected sequence number
2. Fixes RetryTimer not properly incrementing intervals by storing the new
   interval value before starting the timer
Copy link
Member Author

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detailed my changes

case (_, _, { IsEmpty: false } replyTo):
replyTo.Value.Tell(Done.Instance);
case (_, outSeqNr, { IsEmpty: false } replyTo):
replyTo.Value.Tell(outSeqNr); // Send the sequence number instead of Done.Instance
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reply with the seqNo instead of Task.Done

if (newInterval != Interval)
{
Interval = newInterval; // Store the new interval
Timers.StartPeriodicTimer(Retry.Instance, Retry.Instance, newInterval);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the correct backoff interval


// expecting 3 end messages, one for each entity: "entity-0", "entity-1", "entity-2"
await consumerEndProbe.ReceiveNAsync(3, TimeSpan.FromSeconds(5)).ToListAsync();
await consumerEndProbe.ReceiveNAsync(3, TimeSpan.FromSeconds(10)).ToListAsync();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was racy so I took a look at the build logs and the issue was just that we didn't quite get through the 40ish messages we need to send for this assertion to pass, I assume because the Azure DevOps box is pretty tiny. Expanded the timeout here to give it a fighting chance.

Copy link
Contributor

@Arkatufus Arkatufus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) March 19, 2025 22:03
@Aaronontheweb Aaronontheweb disabled auto-merge March 20, 2025 18:29
@Aaronontheweb Aaronontheweb merged commit ce9ef9c into akkadotnet:dev Mar 20, 2025
9 of 12 checks passed
@Aaronontheweb Aaronontheweb deleted the fix-7529-7530-delivery-bugs branch March 20, 2025 18:29
This was referenced Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Akka.Cluster.Sharding.Delivery issue Akka.Cluster.Sharding.Delivery issues

2 participants