Melib: JMap is_online doesn't await connection #159

Closed
opened 2022-01-04 23:40:05 +02:00 by djrenren · 1 comment

If you construct a JmapType and then immediately await is_online like so:

let jmap = JmapType::new(&settings, is_subscribed, event_consumer).unwrap();

jmap.is_online().unwrap().await.unwrap()

It will always fail. Conversely the same order of operations works for ImapType. This issues arises because the implementation is_online does not await the connection when it probably should:

https://git.meli.delivery/meli/meli/src/branch/master/melib/src/backends/jmap.rs#L302

If you construct a JmapType and then immediately await `is_online` like so: ```rust let jmap = JmapType::new(&settings, is_subscribed, event_consumer).unwrap(); jmap.is_online().unwrap().await.unwrap() ``` It will always fail. Conversely the same order of operations works for ImapType. This issues arises because the implementation `is_online` does not await the connection when it probably should: https://git.meli.delivery/meli/meli/src/branch/master/melib/src/backends/jmap.rs#L302

Hm basically you're suggesting we comment out the:

//match timeout(std::time::Duration::from_secs(3), connection.lock()).await

part, like it's done in ImapType? That seems sensible. Thanks for spotting it :)

Hm basically you're suggesting we comment out the: ```rust //match timeout(std::time::Duration::from_secs(3), connection.lock()).await ``` part, like it's done in `ImapType`? That seems sensible. Thanks for spotting it :)
Manos Pitsidianakis added the
bug
label 2022-01-05 11:06:02 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: meli/meli#159
There is no content yet.