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

refactor(server): Break up ServeHTTP for readability #23

Merged
merged 1 commit into from
Dec 21, 2024

Conversation

kalbasit
Copy link
Owner

@kalbasit kalbasit commented Dec 21, 2024

TL;DR

Extracted HTTP handlers for /receive/pop and /receive/flush endpoints into separate methods.

What changed?

  • Moved /receive/pop handler logic into receivePop method
  • Moved /receive/flush handler logic into receiveFlush method
  • Removed //nolint:nestif comment as it's no longer needed
  • Main ServeHTTP method now delegates to these new methods

How to test?

  1. Send HTTP requests to /receive/pop endpoint
    • Verify messages are received correctly
    • Check repeat-last functionality works as expected
  2. Send HTTP requests to /receive/flush endpoint
    • Verify all messages are flushed properly
    • Confirm last message is stored when repeat-last is enabled

Why make this change?

Improves code organization and readability by breaking down the large ServeHTTP method into smaller, focused methods. This makes the code easier to maintain and test while reducing cognitive complexity.

@kalbasit kalbasit marked this pull request as ready for review December 21, 2024 20:46
@kalbasit kalbasit force-pushed the repeat-last-message branch from 84a68c0 to da180ca Compare December 21, 2024 20:50
@kalbasit kalbasit force-pushed the repeat-last-message branch from da180ca to 358fbf6 Compare December 21, 2024 20:54
@kalbasit kalbasit force-pushed the repeat-last-message branch from 358fbf6 to ee6c864 Compare December 21, 2024 20:57
@kalbasit kalbasit force-pushed the repeat-last-message branch 2 times, most recently from b2b97ab to c65781d Compare December 21, 2024 21:00
@kalbasit kalbasit changed the base branch from repeat-last-message to graphite-base/23 December 21, 2024 21:02
@kalbasit kalbasit changed the base branch from graphite-base/23 to main December 21, 2024 21:03
@kalbasit kalbasit merged commit ff9debd into main Dec 21, 2024
3 checks passed
Copy link
Owner Author

Merge activity

  • Dec 21, 4:05 PM EST: A user merged this pull request with Graphite.

@kalbasit kalbasit deleted the refactor-serveHTTP branch December 21, 2024 21:05
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