Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove CancellationTokenSource from DispatcherChannelBase #1606

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

bollhals
Copy link
Contributor

Proposed Changes

This change removes the CancellationTokenSource form the DispatcherChannelBase added in #1347.

Justification:

  • Shutting down the Dispatcher stops correctly without the CTS.
    • There's one difference, which is that it now finishes already enqueued work before fully stopping. (But it is what it used to be in 6.x, so technically this would be a revert to what it used to be)
    • For me at least, it's what I would expect to happen when I shut it down. Leaving work unfinished and undetectable (as there is no indication anywhere for it) sounds wrong to me.
  • Side improvement is that it safes an allocation as well as the Threading.Channels is now able to cache some instance, thus avoiding even more allocations.

Types of Changes

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)
  • Performance change

Checklist

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

Further Comments

@lukebakken lukebakken self-requested a review June 20, 2024 14:54
@lukebakken lukebakken self-assigned this Jun 20, 2024
@lukebakken lukebakken added this to the 7.0.0 milestone Jun 20, 2024
@lukebakken
Copy link
Contributor

lukebakken commented Jun 20, 2024

Thanks @bollhals! How did you notice the behavior that this PR fixes? I would like to add a test.

@lukebakken
Copy link
Contributor

@bollhals I'm going to merge this today and release RC2. I can add a test later on!

@lukebakken lukebakken merged commit bd53007 into rabbitmq:main Jun 21, 2024
11 checks passed
@bollhals
Copy link
Contributor Author

Thanks @bollhals! How did you notice the behavior that this PR fixes?

I stumbeld upon this when I was looking at the allocation of the channel, which I thought wasn't allocating. Which was due to the cancellation token, upon further investigation I identified as not needed. While removing it, I wanted to make sure I didn't change any behaviour during the shutdown, which is where I found the small difference.

@bollhals bollhals deleted the fix/removects branch June 21, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants