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

Adding cache client to nodes manager #609

Merged
merged 1 commit into from
Mar 8, 2025
Merged

Adding cache client to nodes manager #609

merged 1 commit into from
Mar 8, 2025

Conversation

javuto
Copy link
Collaborator

@javuto javuto commented Mar 8, 2025

Adding cache client to nodes manager so data can be consumed from the cache (Redis).

@javuto javuto added the cache Cache related issues label Mar 8, 2025
@javuto javuto requested a review from Copilot March 8, 2025 22:38
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR updates the nodes manager initialization to include a cache client parameter, enabling the consumption of Redis-cached data.

  • Adds a cache parameter to the CreateNodes function in pkg/nodes/nodes.go.
  • Updates calls to CreateNodes in various commands and tests.
  • In some command files, passes an incorrect type instead of a cache client instance.

Reviewed Changes

File Description
pkg/nodes/nodes.go Adds a new parameter for cache client in the function signature.
cmd/cli/main.go Updates CreateNodes call by passing nil for the cache client.
pkg/queries/queries_test.go Updates CreateNodes call in tests to pass nil for the cache client.
cmd/admin/main.go Incorrectly passes redis.Client type instead of an instance.
cmd/tls/main.go Incorrectly passes redis.Client type instead of an instance.
cmd/api/main.go Incorrectly passes redis.Client type instead of an instance.

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

@@ -683,7 +683,7 @@ func osctrlAdminService() {
log.Info().Msg("Initialize settings")
settingsmgr = settings.NewSettings(db.Conn)
log.Info().Msg("Initialize nodes")
nodesmgr = nodes.CreateNodes(db.Conn)
nodesmgr = nodes.CreateNodes(db.Conn, redis.Client)
Copy link
Preview

Copilot AI Mar 8, 2025

Choose a reason for hiding this comment

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

Passing redis.Client as a parameter is incorrect; you should pass an instance of redis.Client (e.g., using redis.NewClient(...)).

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@@ -628,7 +628,7 @@ func osctrlService() {
log.Info().Msg("Initialize settings")
settingsmgr = settings.NewSettings(db.Conn)
log.Info().Msg("Initialize nodes")
nodesmgr = nodes.CreateNodes(db.Conn)
nodesmgr = nodes.CreateNodes(db.Conn, redis.Client)
Copy link
Preview

Copilot AI Mar 8, 2025

Choose a reason for hiding this comment

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

Passing redis.Client as a parameter is incorrect; ensure you pass a valid instance of redis.Client via an appropriate constructor.

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@@ -489,7 +489,7 @@ func osctrlAPIService() {
log.Info().Msg("Initialize settings")
settingsmgr = settings.NewSettings(db.Conn)
log.Info().Msg("Initialize nodes")
nodesmgr = nodes.CreateNodes(db.Conn)
nodesmgr = nodes.CreateNodes(db.Conn, redis.Client)
Copy link
Preview

Copilot AI Mar 8, 2025

Choose a reason for hiding this comment

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

The call uses redis.Client incorrectly instead of a cache client instance; please change it to pass an instance created by redis.NewClient(...).

Suggested change
nodesmgr = nodes.CreateNodes(db.Conn, redis.Client)
nodesmgr = nodes.CreateNodes(db.Conn, redisClient)

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@javuto javuto merged commit eb256c8 into main Mar 8, 2025
52 checks passed
@javuto javuto deleted the nodes-cache-client branch March 8, 2025 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cache Cache related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant