-
Notifications
You must be signed in to change notification settings - Fork 3
Fix amqp #51
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
base: main
Are you sure you want to change the base?
Conversation
Warning Rate limit exceeded@abnegate has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 23 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
WalkthroughThe changes introduce publisher confirm support and retry logic to the AMQP broker, allowing configurable reliability for message publishing. Dependency version constraints in composer.json are broadened. The AMQPSwoole broker's connection instantiation is simplified. New end-to-end tests for AMQP with acknowledgments and AMQPSwoole with acknowledgments are added. The test matrix is updated to include new adapters. Changes
Sequence Diagram(s)sequenceDiagram
participant Test as AMQPAckTest / AMQPSwooleAckTest
participant Publisher as AMQP / AMQPSwoole Publisher
participant Broker as AMQP / AMQPSwoole Broker
participant Queue as Queue
Test->>Publisher: getPublisher(requireAck=true)
Test->>Queue: getQueue()
Publisher->>Broker: enqueue(Queue, payload)
alt requireAck = true
Broker->>Broker: publish message (retry up to maxEnqueueAttempts)
Broker->>Broker: wait_for_pending_acks(timeout)
Broker-->>Publisher: success/failure
else requireAck = false
Broker->>Broker: publish message (no confirm)
Broker-->>Publisher: success/failure
end
Possibly related PRs
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
composer.lock
is excluded by!**/*.lock
📒 Files selected for processing (5)
.github/workflows/tests.yml
(1 hunks)composer.json
(1 hunks)src/Queue/Broker/AMQP.php
(6 hunks)src/Queue/Broker/AMQPSwoole.php
(1 hunks)tests/Queue/E2E/Adapter/AMQPAckTest.php
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
tests/Queue/E2E/Adapter/AMQPAckTest.php (3)
src/Queue/Queue.php (1)
Queue
(5-15)tests/Queue/E2E/Adapter/Base.php (1)
Base
(11-130)src/Queue/Broker/AMQP.php (1)
AMQP
(24-297)
src/Queue/Broker/AMQP.php (2)
src/Queue/Message.php (1)
Message
(5-81)src/Queue/Broker/AMQPSwoole.php (1)
withChannel
(16-56)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Adapter Tests (SwooleRedisCluster)
- GitHub Check: Adapter Tests (Workerman)
- GitHub Check: Adapter Tests (Swoole)
🔇 Additional comments (7)
composer.json (1)
28-28
: LGTM!The more restrictive version constraint ensures stability while allowing patch-level updates.
tests/Queue/E2E/Adapter/AMQPAckTest.php (1)
10-21
: LGTM!The test correctly configures AMQP with publisher acknowledgments enabled, providing coverage for the new acknowledgment feature.
src/Queue/Broker/AMQPSwoole.php (2)
25-28
: LGTM!Using named parameters improves code clarity and maintainability.
30-32
: LGTM!The modernized callable handling using
\is_callable
and direct invocation is cleaner and more performant thancall_user_func
.Also applies to: 36-38
src/Queue/Broker/AMQP.php (3)
42-56
: LGTM!The new acknowledgment-related parameters have sensible defaults that balance reliability and performance.
183-212
: LGTM!The retry logic with publisher confirms is well-implemented, handling connection issues gracefully while respecting the configured maximum attempts.
266-279
: LGTM!The modernized callable handling and conditional publisher confirms setup are implemented correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
tests/Queue/E2E/Adapter/AMQPSwooleAckTest.php (1)
41-41
: Consider making sleep durations configurable.The hard-coded
sleep(1)
values may need adjustment based on different environments or testing scenarios. Consider extracting these as constants or configuration parameters.+ private const TEST_SLEEP_DURATION = 1; + // Then replace all sleep(1) calls with: - sleep(1); + sleep(self::TEST_SLEEP_DURATION);Also applies to: 57-57, 101-101, 103-103, 105-105
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/Queue/Broker/AMQP.php
(7 hunks)tests/Queue/E2E/Adapter/AMQPAckTest.php
(1 hunks)tests/Queue/E2E/Adapter/AMQPSwooleAckTest.php
(1 hunks)tests/Queue/E2E/Adapter/AMQPSwooleTest.php
(1 hunks)tests/Queue/E2E/Adapter/AMQPTest.php
(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- tests/Queue/E2E/Adapter/AMQPSwooleTest.php
- tests/Queue/E2E/Adapter/AMQPTest.php
🚧 Files skipped from review as they are similar to previous changes (2)
- tests/Queue/E2E/Adapter/AMQPAckTest.php
- src/Queue/Broker/AMQP.php
🧰 Additional context used
🪛 GitHub Actions: Linter
tests/Queue/E2E/Adapter/AMQPSwooleAckTest.php
[error] 1-1: PSR 12 style issue: blank line between import groups missing. Run 'vendor/bin/pint --write' to fix code style issues.
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Adapter Tests (Pool)
- GitHub Check: Adapter Tests (Workerman)
- GitHub Check: Adapter Tests (AMQPAck)
- GitHub Check: Adapter Tests (AMQP)
- GitHub Check: Adapter Tests (SwooleRedisCluster)
- GitHub Check: Adapter Tests (Swoole)
- GitHub Check: Adapter Tests (AMQPSwoole)
🔇 Additional comments (3)
tests/Queue/E2E/Adapter/AMQPSwooleAckTest.php (3)
13-22
: LGTM! Publisher configuration looks correct.The AMQPSwoole broker is properly configured with acknowledgment enabled, which aligns with the test's purpose of testing the ack functionality.
24-27
: LGTM! Queue configuration is appropriate.The queue name 'amqp-swoole' clearly indicates the broker type being tested.
68-110
: LGTM! Retry test logic is comprehensive.The retry test properly validates the retry functionality with different parameters and follows good testing practices with the @Depends annotation.
match (true) { | ||
$result instanceof Commit => $amqpMessage->ack(true), | ||
$result instanceof NoCommit => null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed because ack(true)
acknowledges all prior messages. So if they fail, they can't be re-queued or sent to the failed queue. Consumer should only acknowledge the current message
Summary by CodeRabbit
New Features
Chores
Style