Skip to content

Add option to close passed in client #66

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

Merged
merged 1 commit into from
Nov 20, 2020
Merged

Add option to close passed in client #66

merged 1 commit into from
Nov 20, 2020

Conversation

jsumners
Copy link
Member

@jsumners jsumners commented Nov 20, 2020

Resolves issue #64

Checklist

@@ -55,6 +55,9 @@ function fastifyRedis (fastify, options, next) {
}

fastify.decorate('redis', client)
if (options.closeClient === true) {
fastify.addHook('onClose', close)
}
Copy link
Member

Choose a reason for hiding this comment

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

I think we would need to support when this is false in all cases.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure about that. The issue is around passing in a specific client and managing that outside instance.

Copy link
Member

Choose a reason for hiding this comment

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

I mean, if somebody is not passing a client in and closeClient: false, then closing the client seems off.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm unclear why they would do that or why it would even be supported. They wouldn't be able to manage it without first pulling the instance from Fastify.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm, let's ship this anyway :)

@jsumners
Copy link
Member Author

At your leisure. I have no permissions here.

@mcollina mcollina merged commit c042182 into fastify:master Nov 20, 2020
@jsumners jsumners deleted the issue-64 branch November 20, 2020 18:33
@starnayuta starnayuta mentioned this pull request Apr 10, 2023
4 tasks
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.

2 participants