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

Change the option name from redelivery to requeue #71

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

msmakouz
Copy link
Member

@msmakouz msmakouz commented Nov 21, 2024

Q A
Bugfix? ✔️
Breaks BC?
New feature?

@msmakouz msmakouz added the bug Something isn't working label Nov 21, 2024
@msmakouz msmakouz requested a review from rustatian November 21, 2024 10:27
@msmakouz msmakouz self-assigned this Nov 21, 2024
Copy link

coderabbitai bot commented Nov 21, 2024

Walkthrough

The pull request modifies the ReceivedTask class in src/Task/ReceivedTask.php, specifically changing the response key in the nack method from 'redelivery' to 'requeue'. This adjustment affects how message handling status is communicated. Additionally, the complete and fail methods are deprecated, encouraging the use of alternative methods for task management. Corresponding changes are made in the ReceivedTaskTest class to reflect the new response structure. Overall, the control flow and error handling remain unchanged.

Changes

File Change Summary
src/Task/ReceivedTask.php - Updated nack method response key from 'redelivery' to 'requeue'.
- Marked complete and fail methods as deprecated, suggesting use of ack, nack, and requeue.
tests/Unit/Task/ReceivedTaskTest.php - Updated testNack method to check for 'requeue' instead of 'redelivery' in the payload.

Possibly related PRs

  • Add support for ack, nack, and requeue methods #66: The changes in the ReceivedTask class regarding the nack method and the deprecation of complete and fail methods are directly related to the modifications introduced in this PR, which also focuses on the nack method and the introduction of new methods for task acknowledgment and requeuing.

Poem

🐰 In the meadow where tasks do play,
A nack now sings a new ballet.
From 'redelivery' to 'requeue' it flies,
With deprecations, old ways say goodbye.
Hopping forward, we embrace the new,
With joy in our hearts, we bid adieu! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (1)
src/Task/ReceivedTask.php (1)

Line range hint 63-63: Enhance deprecation notice with migration guidance

The current deprecation notice doesn't provide clear guidance on when to use nack() vs requeue(). Consider adding more specific migration instructions.

-     * @deprecated Since v4.5.0, use {@see nack()} or {@see requeue()} instead.
+     * @deprecated Since v4.5.0, use:
+     *             - {@see nack()} for temporary failures that may be retried
+     *             - {@see requeue()} for explicit requeuing with optional delay
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1df9702 and 9402267.

📒 Files selected for processing (2)
  • src/Task/ReceivedTask.php (1 hunks)
  • tests/Unit/Task/ReceivedTaskTest.php (1 hunks)
🔇 Additional comments (2)
src/Task/ReceivedTask.php (1)

Line range hint 12-13: Documentation is consistent with new naming

The PHPDoc type hint for ErrorData correctly uses the 'requeue' key, maintaining consistency with the implementation.

tests/Unit/Task/ReceivedTaskTest.php (1)

137-137: Verify implementation alignment

The test now expects 'requeue' in the payload, which implies a change in the ReceivedTask implementation.

Let's verify the implementation is aligned:

✅ Verification successful

Implementation is correctly aligned

The implementation in ReceivedTask matches the test expectations. Both ReceivedTask::nack() and the test use 'requeue' in their payloads:

  • src/Task/ReceivedTask.php: 'requeue' => $redelivery
  • tests/Unit/Task/ReceivedTaskTest.php: 'requeue' => $redelivery
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the nack method implementation and its usages
ast-grep --pattern 'function nack($$$) {
  $$$
}'

# Also check for any remaining instances of 'redelivery'
rg 'redelivery' --type php

Length of output: 833

src/Task/ReceivedTask.php Show resolved Hide resolved
tests/Unit/Task/ReceivedTaskTest.php Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants