Open prostomarkeloff opened 4 years ago
(maybe) supporting longpoll
In my opinion this has little relation to async
/.await
, so please open a separate issue for supporting long polling.
getting moved to async/.await
I am certainly not against it!
The reason vk-bot
is currently synchronous is as follows:
rvk
was asynchronous (long before async
/.await
).v0.2.0
for some reason that I'm not entirely sure about now :sweat_smile:.vk-bot
, and decided to go for synchronous as well (async
/.await
was also not a thing in Rust yet).So for making it async
/.await
, the following needs to be done, I think (do correct me if I'm wrong somewhere):
Transition rvk
to use async
/.await
. While this is likely not strictly required I guess, it'd certainly be nice for essentially the "backend" of vk-bot
to be asynchronous as well in the first place.
This should be relatively straightforward, most actual changes would be in api.rs
:
surf
is a great option right now?APIClient
should store some sort of a Client
if such thing is needed/exists in the chosen library.call_method
should be made async
and use that library to call API methods.Release a new (major) version of rvk
.
Close Dependabot's PR attempt to migrate vk-bot
to that version as it should fail, if I understand correctly.
Change vk-bot
to use the new version of rvk
.
A little bit more involved than step 1: while it should be straightforward theoretically, I'm not exactly sure how well/simply that'd work with Rocket. Anything mentioning API calls would probably need to be changed initially, and then rustc
is your best friend, as always :wink:.
Release a new (major) version of vk-bot
.
I'd love it and can help with it.
Awesome! Then I think you can start by opening a PR on rvk
with the needed changes (also feel free to open a draft PR right away if you want).
The first and second parts are ready I think :smile:
But I'm a bit unsure about rocket because it supports async/.await only in git's version. What's about moving to any other framework or ...?
Ok, so u32i64/rvk#9 is merged now. As far as I understand, you'd like to change some other things in rvk
as well.
So we could either:
rvk
version now and proceed with other changes to get async
/.await
support first, and then do the other improvements after that is done.async
/.await
.Personally, I think 1 is a better option. Do you have any preference?
But I'm a bit unsure about rocket because it supports async/.await only in git's version. What's about moving to any other framework or ...?
Hmm. Ideally I'd like to not change that... but I see that Rocket's async is still in progress, yes. The good news is that there are just a handful of HTTP requests that need to be handled, so switching shouldn't be that complex.
Do you have any preferred alternatives in mind? From my quick look warp
looks good enough for vk-bot
's purposes.
Yeah, I think warp is ok for this. I choose the second option. I'll write here when rvk
is ready.
Ok, I think rvk is ready! I'll add async/.await
support for vk-bot
in next PR. Also I want to extend the features of vk-bot
and release async/.await
with them :smile:
No way of getting moved to async/.await and (maybe) supporting longpoll? I'd love it and can help with it.