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

Support for 'customizing' connections created by bb8::Pool #88

Closed
agersant opened this issue Dec 11, 2020 · 4 comments
Closed

Support for 'customizing' connections created by bb8::Pool #88

agersant opened this issue Dec 11, 2020 · 4 comments

Comments

@agersant
Copy link
Contributor

agersant commented Dec 11, 2020

Hello and thank you for working on this crate!

I am in the process of migrating https://github.com/agersant/polaris to an async web framework. As part of this process, I am evaluating migrating from diesel + r2d2 to diesel + bb8 to interact with the SQLite database which power this app.

A feature that exists in r2d2 is the possibility to specify a ConnectionCustomizer which performs initialization work on every connection that a pool creates. For my use case, I set some SQLite PRAGMA configurations (journaling_mode, enable foreign keys, etc.) on every connection that comes out of the pool.

Could you consider adding a similar feature to bb8 pools?

Many thanks!

@djc
Copy link
Owner

djc commented Dec 11, 2020

Yes, I think it would make sense to add this. Would you like to attempt to contribute this change?

(Polaris looks interesting, BTW. Does the Android client cache songs locally to limit bandwidth usage? Are you planning on an iOS client?)

@agersant
Copy link
Contributor Author

Yeah I can try implementing this, although I'll probably have some questions on the way!

The Polaris client does cache songs locally, both to limit bandwidth usage and also to support playback in offline mode. No concrete plans for an iOS client by me at the moment. I have been thinking about rewriting the Android client with Flutter, which would be a step in the right direction.

@djc
Copy link
Owner

djc commented Dec 11, 2020

If you have any questions, just ask here, I'm happy to answer them. Probably good to just start copying API from r2d2, except the functions return a Box.

@agersant
Copy link
Contributor Author

agersant commented Dec 14, 2020

As a side-note, my migration ran into a pretty serious roadblock 😭
overdrivenpotato/bb8-diesel#1

@djc djc closed this as completed in fc39fd3 Dec 14, 2020
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

No branches or pull requests

2 participants