Skip to content

refactor: remove dead retry code and consolidate reservation emit methods#698

Open
kamilwronka wants to merge 1 commit intodevelopfrom
claude/small-refactor-apr07
Open

refactor: remove dead retry code and consolidate reservation emit methods#698
kamilwronka wants to merge 1 commit intodevelopfrom
claude/small-refactor-apr07

Conversation

@kamilwronka
Copy link
Copy Markdown
Contributor

@kamilwronka kamilwronka commented Apr 7, 2026

Summary

  • Remove dead handleRetryQueue method from both apps/api/src/rabbitmq/retry.service.ts and apps/activity/src/shared/rabbitmq/retry.service.ts — this method (and its AmqpMessage interface) was never called anywhere in the codebase. Removes ~35 lines of dead code per file.
  • Consolidate duplicate reservation emit methods in apps/api/src/reservations/reservations.service.tsemitReservationCreated and emitReservationDeleted were identical except for the routing key. Replaced with a single emitReservationEvent(guildId, reservation, routingKey) method.

Safety

  • handleRetryQueue: Confirmed zero callers via codebase-wide grep. Only the definition existed.
  • Reservation emit consolidation: Pure mechanical refactor — same payload construction, same amqpConnection.publish call, just parameterized by routing key.
  • All existing tests pass (112/112 in API, 3/3 in activity). Pre-existing test file import failures (@lootlog/nest-shared resolution) are unrelated.

Files touched

File Change
apps/api/src/rabbitmq/retry.service.ts Removed handleRetryQueue + AmqpMessage interface
apps/activity/src/shared/rabbitmq/retry.service.ts Removed handleRetryQueue + AmqpMessage interface
apps/api/src/reservations/reservations.service.ts Consolidated 2 emit methods into 1

Residual risks

None — all changes are strictly subtractive or mechanical consolidation with no behavioral change.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Streamlined internal retry queue handling logic for improved code clarity.
    • Consolidated event publishing methods to reduce code duplication and enhance maintainability.

…it methods

- Remove unused `handleRetryQueue` method and its `AmqpMessage` interface
  from both `apps/api` and `apps/activity` retry services (never called anywhere)
- Consolidate duplicate `emitReservationCreated`/`emitReservationDeleted` into
  a single `emitReservationEvent` method parameterized by routing key

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2c28d222-a183-4a0c-9d57-1fb264324c2b

📥 Commits

Reviewing files that changed from the base of the PR and between f99033e and deeb895.

📒 Files selected for processing (3)
  • apps/activity/src/shared/rabbitmq/retry.service.ts
  • apps/api/src/rabbitmq/retry.service.ts
  • apps/api/src/reservations/reservations.service.ts
💤 Files with no reviewable changes (2)
  • apps/activity/src/shared/rabbitmq/retry.service.ts
  • apps/api/src/rabbitmq/retry.service.ts

📝 Walkthrough

Walkthrough

Removed AmqpMessage interface and handleRetryQueue method from retry services in activity and API applications, consolidating retry decision logic. Refactored reservations service to replace two event-specific publisher methods with a single parameterized emitReservationEvent method.

Changes

Cohort / File(s) Summary
Retry Service Cleanup
apps/activity/src/shared/rabbitmq/retry.service.ts, apps/api/src/rabbitmq/retry.service.ts
Removed internal AmqpMessage interface and handleRetryQueue method. Retry queue-specific header extraction, retry count computation, and logging now consolidated into handleRetryLogic.
Reservations Event Publishing
apps/api/src/reservations/reservations.service.ts
Consolidated emitReservationCreated and emitReservationDeleted methods into a single emitReservationEvent(guildId, reservation, routingKey) method. Call sites updated to pass appropriate routing keys.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Feature/reservations #304: May depend on or be impacted by the removal of AmqpMessage interface and handleRetryQueue method that previously handled retry logic based on AMQP message properties.

Poem

🐰 A queue once tangled, now made light,
One method serves both wrong and right,
With routing keys, events now flow,
The retry path lies clean below! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: removing dead retry code and consolidating reservation emit methods, matching the actual changeset content.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/small-refactor-apr07

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant