Open spikecodes opened 1 month ago
Hello @spikecodes, I am not that familiar with rocket but it looks like for your example you might be able to address the issue by establishing the postgresql embedded instance prior to running rocket, then connect to it using whatever pattern rocket prescribes for connecting to a database. I created an axum example that illustrates this approach #123.
Hello @brianheineman, thanks for sharing that Axum example. I will try the Rocket-equivalent to see if that fixes the thread safety issues.
I'm trying to use the new
install
command from the postgresql-extensions crate but can't seem to pass the Settings object (regardless if I clone the Settings, reconstruct it or just use a newSettings::default()
) without getting this error in my Rocket::launch method:My code:
Maybe the fix for this would be making the install method take a trait that must implement Send and Sync to force the Rust compiler to accept that the Settings type is threadsafe? Or wrap it in a Box?