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

Add is-closed? and is-running? functions #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lukaszkorecki
Copy link

@lukaszkorecki lukaszkorecki commented Nov 29, 2023

This is useful to check the state of the connection pool when it's wrapped in a Component (or similar) to avoid issues when trying to close a pool that's already been closed but its instance is still around.

Plus a bunch of improvements:

  • Updates all dependencies
  • Closes Reflection warnings #97
  • A proper connection test with H2
  • Updated documentation to use next.jdbc

Lastly, I'd be more than happy to rewrite all tests to use clojure.test - It's probably the first time I'm seeing expectations and run into weird issues with it, for example:

;; this works:
  (let [running? (hikari-cp/is-running? pool)
        closed? (hikari-cp/is-closed? pool)]
    (expect true running?)
    (expect false closed?))

;; but this doesn't (always returns false!)

(expect true (hikari-cp/is-running? pool))

Given that there's very little difference between:

(expect false (hikari-cp/is-closed? pool))

and

(is (false? (hikari-cp/is-closed? pool)))

I think it would be a simple refactoring, and one less dependency to worry about.

Lastly, expectations has a bunch of reflection warnings - I've enabled them globally in project.clj

Plus a bunch of improvements:

- Closes tomekw#97
- A proper connection test with H2
- Updated documentation to use `next.jdbc`
@tomekw
Copy link
Owner

tomekw commented Dec 2, 2023

Thank you 💙

I will take a proper look on Monday!

@tomekw
Copy link
Owner

tomekw commented Dec 2, 2023

Lastly, I'd be more than happy to rewrite all tests to use clojure.test

I would be happy to see this! 🙇🏻‍♂️

@lukaszkorecki
Copy link
Author

Lastly, I'd be more than happy to rewrite all tests to use clojure.test

I would be happy to see this! 🙇🏻‍♂️

Sure thing, if you want I can make it a part of this PR, just let me know

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.

Reflection warnings
2 participants