Porting to v0.5 - alternative startup #2493
-
Hi All, I'm nearly done with converting my rocket project to v0.5 but ran into a snag mostly due to not fully comprehending some of the new async/ignite/launch stuff. My current v0.4 main function performs a whole bunch of startup stuff before it even comes to rocket. Checking my database, performing upgrades of tables, doing some maintenance, all the fun stuff associated with running up a new version. At the end, if all is well, I start rocket. So in my case I settled on:
However when attempting to run I get:
It seems to be running fully through my startup code and initialising rocket, so it may be completely unrelated to how I've setup my startup code, but it's one difference that stood out. If anyone has any tips on what I may be doing wrong here, that be great :) |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
I think it doesn't matter, whether you use In my project, I put the
This also works with integration tests. |
Beta Was this translation helpful? Give feedback.
-
Sorry for the late reply, I was traveling. Ok changing the way we start doesn't seem to make a difference. I traced it to a call to A bit of a pain because this code should be run before tokio starts but we don't seem to have that ability... |
Beta Was this translation helpful? Give feedback.
-
Ok, quick little update now that we've made some progress here. The culprit turned out to be the Postgres crate we were using. This is actually a wrapper around Plenty of stuff to polish up but it looks like it's breathing now :) |
Beta Was this translation helpful? Give feedback.
-
Thanks for the help everyone. Getting a hang of it all now and pretty much through the first migration pass :) |
Beta Was this translation helpful? Give feedback.
Ok, quick little update now that we've made some progress here.
The culprit turned out to be the Postgres crate we were using. This is actually a wrapper around
tokio-postgres
to turn an asynchronous implementation into a synchronous implementation, the opposite of what we need today :).So we've switched over to using
tokio-postgres
directly and refactored nearly our entire API to use async :)Plenty of stuff to polish up but it looks like it's breathing now :)