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

feat: Decouple NATS storage driver from gofiber/fiber #1470

Merged
merged 2 commits into from
Jul 8, 2024

Conversation

gaby
Copy link
Member

@gaby gaby commented Jul 8, 2024

Description

  • Decouple the NATS storage driver from https://github.com/gofiber/fiber by removing the fiberlog.
  • Remove the embedded logging functions.
  • Remove the logger and verbose params.

Note: This is the only Storage driver that depends on gofiber/fiber, removing this dependency will decouple this whole repo from gofiber/fiber.

Summary by CodeRabbit

  • Documentation

    • Clarified requirements for Go version and improved terminology in NATS Key/Value storage driver documentation.
  • Configuration

    • Adjusted default wait time for connection establishment from 100ms to 250ms.
  • Testing

    • Added Go 1.22.x to test workflow.
    • Increased sleep duration before testing NATS from 2 to 5 seconds.

@gaby gaby requested a review from a team as a code owner July 8, 2024 01:02
@gaby gaby requested review from sixcolors, ReneWerner87 and efectn and removed request for a team July 8, 2024 01:02
Copy link
Contributor

coderabbitai bot commented Jul 8, 2024

Walkthrough

The changes enhance the documentation and configuration of the NATS Key/Value storage driver in Go. They clarify version requirements and improve language consistency. Configuration updates remove logging dependencies and adjust default connection wait times. Additionally, the testing workflow for NATS now includes Go 1.22 and an extended sleep duration before testing.

Changes

File(s) Summary
nats/README.md Improved wording clarity and consistency; updated Config struct examples
nats/config.go Removed logging package references; increased default connection wait time
nats/nats.go Removed helper functions for logging and error handling; updated error handling in functions
.github/workflows/test-nats.yml Added Go 1.22 to the test matrix; increased pre-test sleep duration

Poem

In NATS we trust, in code we thrive,
Configs updated, logs aside, we strive.
Go versions climb, workflows extend,
A smoother path for tests, my friend.

With patience in thread, connections rise,
Fiber's future bright, under open skies.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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
Contributor

@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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8b1d41d and 04fb905.

Files ignored due to path filters (2)
  • nats/go.mod is excluded by !**/*.mod
  • nats/go.sum is excluded by !**/*.sum, !**/*.sum
Files selected for processing (3)
  • nats/README.md (2 hunks)
  • nats/config.go (4 hunks)
  • nats/nats.go (3 hunks)
Files skipped from review due to trivial changes (2)
  • nats/README.md
  • nats/config.go
Additional comments not posted (4)
nats/nats.go (4)

41-47: Approved: Simplified connectHandler function.

The refactoring simplifies the function by reducing its responsibilities. It now focuses solely on initializing kv and updating err if necessary.


Line range hint 57-61:
Approved: Removed disconnectErrHandler function.

The removal of this function aligns with the goal of decoupling the NATS storage driver from the gofiber/fiber framework by eliminating embedded logging functions.


73-77: Approved: Removed errorHandler function.

The removal of this function aligns with the goal of decoupling the NATS storage driver from the gofiber/fiber framework by eliminating embedded logging functions.


Line range hint 84-95:
Approved: Updated newNatsKV function.

The error handling logic has been updated to return errors directly instead of logging them. This change simplifies the function and aligns with the goal of decoupling the NATS storage driver from the gofiber/fiber framework.

Copy link
Contributor

@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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 04fb905 and b5f9269.

Files selected for processing (1)
  • .github/workflows/test-nats.yml (2 hunks)
Additional comments not posted (2)
.github/workflows/test-nats.yml (2)

19-19: LGTM! Adding Go 1.22.x to the matrix is a good practice.

This ensures compatibility with the latest Go version.


33-33: LGTM! Increasing the sleep duration to 5 seconds ensures proper initialization of the NATS server.

This change helps avoid race conditions during testing.

@ReneWerner87 ReneWerner87 merged commit 920bb09 into main Jul 8, 2024
13 of 14 checks passed
@gaby gaby deleted the remove-fiber-dependency branch July 8, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants