Skip to content

offload database handling to rocket_db_pools #1

Description

@justinhschaaf

Summarize the request

Currently, the database connection is implemented directly in Diesel and the connection is passed around as a State wrapping a Mutex. rocket_db_pools provides a way to maintain database connections in a Rocket-friendly wrapper. This wrapper has full support for Diesel and could be easier to integrate, automatically pulling the database connection URI from Rocket's config and creating the connection in a safe way for us.

  • See this Medium article for an example of how this could be done, main thing to note is the &** syntax.

The primary reason I'm making this issue and not making the changes immediately is because it depends on Diesel 2.1.x, whereas we're currently on Diesel 2.2.x and waiting for 2.3.x to release for features we need. See rwf2/Rocket#2868 for when this may be updated.

Use case

This would relieve some of the management duties over the connection to Rocket, simplifying our implementation. It may unfortunately decrease code readability.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions