Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Messenger] Remove fixNoAutoAckStamp handling inWorker::flush()#61291

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@wazum
Copy link
Contributor

@wazumwazum commentedJul 31, 2025
edited by carsonbot
Loading

QA
Branch?6.4
Bug fix?yes
New feature?no
Deprecations?no
Issues-
LicenseMIT

Description

This PR removes unused code in theWorker::flush() method where an envelope modification was never used.

Changes

  • Removed the line$envelope = $envelope->withoutAll(NoAutoAckStamp::class); which was modifying a local variable that was immediately discarded
  • Moved theNoAutoAckStamp removal to the catch block where it's actually needed

Why this change?

The line was unused code because:

  1. Ifdispatch() succeeds: The modified envelope is never used (foreach continues/ends)
  2. Ifdispatch() throws: The line is never reached

Moving the stamp removal to thecatch block ensures that envelopes stored for acknowledgment have clean state - they shouldn't contain a "no auto ack" stamp when they're about to be acknowledged.

@carsonbotcarsonbot added this to the6.4 milestoneJul 31, 2025
@carsonbotcarsonbot changed the title[Messenger] Remove dead code in Worker::flush() method[Messenger] Remove unused code in Worker::flush() methodJul 31, 2025
@OskarStarkOskarStark changed the title[Messenger] Remove unused code in Worker::flush() method[Messenger] Remove unused code inWorker::flush() methodAug 1, 2025
@OskarStark
Copy link
Contributor

This PR not only removes unused code, but changes code. Can you please add or modify an existing test case? Thanks

nicolas-grekas and wazum reacted with thumbs up emoji

@wazumwazumforce-pushed thebugfix/messenger-flush-dead-code branch from1d1766d tobb580f1CompareAugust 1, 2025 07:18
@wazumwazum changed the title[Messenger] Remove unused code inWorker::flush() method[Messenger] Remove dead code and fixNoAutoAckStamp handling inWorker::flush()Aug 1, 2025
@carsonbotcarsonbot changed the title[Messenger] Remove dead code and fixNoAutoAckStamp handling inWorker::flush()[Messenger] Remove unused code and fixNoAutoAckStamp handling inWorker::flush()Aug 1, 2025
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

The fix does make sense to me.
Ideally the test case shouldn't use reflection to hack into internal structures.
Would it be possible to use only public methods instead?

@nicolas-grekasnicolas-grekas changed the title[Messenger] Remove unused code and fixNoAutoAckStamp handling inWorker::flush()[Messenger] Remove fixNoAutoAckStamp handling inWorker::flush()Aug 1, 2025
@wazumwazumforce-pushed thebugfix/messenger-flush-dead-code branch frombb580f1 to1d3caf6CompareAugust 1, 2025 16:05
@wazum
Copy link
ContributorAuthor

That's the best I could come up with. Using only minimal Reflection to fill theunacks property.
Previous attempts using the natural flow resulted in "The acknowledger was not called by the batch handler" fatal errors. I couldn't solve this otherwise.

The line `$envelope = $envelope->withoutAll(NoAutoAckStamp::class);` was modifying a local variable that was never used after assignment. This change moves the stamp removal to the catch block where it's actually needed, ensuring envelopes stored for acknowledgment don't contain contradictory NoAutoAckStamp.
@wazumwazumforce-pushed thebugfix/messenger-flush-dead-code branch from1d3caf6 to06b1d8fCompareAugust 1, 2025 16:13
@nicolas-grekas
Copy link
Member

Thank you@wazum.

@nicolas-grekasnicolas-grekas merged commit9aa072c intosymfony:6.4Aug 5, 2025
10 of 11 checks passed
This was referencedAug 29, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

6.4

Development

Successfully merging this pull request may close these issues.

5 participants

@wazum@OskarStark@nicolas-grekas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp