parent
613c3de3d2
commit
50cd81772f
|
@ -341,7 +341,32 @@ impl MailBackend for JmapType {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn watch(&self) -> ResultFuture<()> {
|
fn watch(&self) -> ResultFuture<()> {
|
||||||
Err(MeliError::from("JMAP watch for updates is unimplemented"))
|
let connection = self.connection.clone();
|
||||||
|
let store = self.store.clone();
|
||||||
|
Ok(Box::pin(async move {
|
||||||
|
{
|
||||||
|
let mut conn = connection.lock().await;
|
||||||
|
conn.connect().await?;
|
||||||
|
}
|
||||||
|
loop {
|
||||||
|
{
|
||||||
|
let mailbox_hashes = {
|
||||||
|
store
|
||||||
|
.mailboxes
|
||||||
|
.read()
|
||||||
|
.unwrap()
|
||||||
|
.keys()
|
||||||
|
.cloned()
|
||||||
|
.collect::<SmallVec<[MailboxHash; 16]>>()
|
||||||
|
};
|
||||||
|
let conn = connection.lock().await;
|
||||||
|
for mailbox_hash in mailbox_hashes {
|
||||||
|
conn.email_changes(mailbox_hash).await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
crate::connections::sleep(std::time::Duration::from_secs(60)).await;
|
||||||
|
}
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mailboxes(&self) -> ResultFuture<HashMap<MailboxHash, Mailbox>> {
|
fn mailboxes(&self) -> ResultFuture<HashMap<MailboxHash, Mailbox>> {
|
||||||
|
|
Loading…
Reference in New Issue