Closed stoksc closed 4 years ago
Can you post a little code sample somewhere of what's failing for you?
Yeah sure, here it is https://gitlab.com/stoked_/actix-bb8-try/tree/master
Didn't really have a grasp on actix when I opened this, actix has it's own runtime in the actix-rt
packages.. trying to spawn just with tokio::spawn
results in an error (no executor) but patching bb8 to use actix_rt::spawn
works just fine. Rehosted the working example on github. Looks like actix-rt
will have an #[actix_rt::main]
for async mains, to remove some of the complexity from this.
https://github.com/stoksc/actix-bb8-service
Patched bb8:
This seems like something that actix and tokio need to sort out because forking every async library is nuts.
Totally agree. State of async/await in rust right now is less than desirable..
For now I'll just stick to hyper since they seem to get along.
Have a bit of an issue. I decided to dip my toes in by trying to make actix-web run async/await with a pool. Went with bb8 because you're on new futures already 👍 🎊
After a little work, I ended up with this error over and over again:
getting thrown from inside bb8's Pool. After looking into it some more, it's because the reaper is spawned off immediately on building the pool, but the tokio runtime isn't ready until you call
System::run
on the actix system. However, I need to build the pool to give to theactix_web::HttpServer
before I start the system.Not entirely a bb8 issue, I'm sure it works fine with hyper but I was wondering if you had any ideas.
Validated by forking and just commenting out where the reaper is scheduled. Works fine and I get a db connection.