mirror of
https://github.com/chatmail/core.git
synced 2026-05-09 01:46:30 +03:00
fix: bubble up QUOTA errors
This commit is contained in:
15
src/quota.rs
15
src/quota.rs
@@ -124,14 +124,16 @@ impl Context {
|
|||||||
/// in case for some providers the quota is always at ~100%
|
/// in case for some providers the quota is always at ~100%
|
||||||
/// and new space is allocated as needed.
|
/// and new space is allocated as needed.
|
||||||
pub(crate) async fn update_recent_quota(&self, session: &mut ImapSession) -> Result<()> {
|
pub(crate) async fn update_recent_quota(&self, session: &mut ImapSession) -> Result<()> {
|
||||||
|
info!(self, "Updating IMAP quota.");
|
||||||
|
|
||||||
let quota = if session.can_check_quota() {
|
let quota = if session.can_check_quota() {
|
||||||
let folders = get_watched_folders(self).await?;
|
let folders = get_watched_folders(self).await?;
|
||||||
get_unique_quota_roots_and_usage(session, folders).await
|
Some(get_unique_quota_roots_and_usage(session, folders).await?)
|
||||||
} else {
|
} else {
|
||||||
Err(anyhow!(stock_str::not_supported_by_provider(self).await))
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Ok(quota) = "a {
|
let recent = if let Some(quota) = "a {
|
||||||
match get_highest_usage(quota) {
|
match get_highest_usage(quota) {
|
||||||
Ok((highest, _, _)) => {
|
Ok((highest, _, _)) => {
|
||||||
if needs_quota_warning(
|
if needs_quota_warning(
|
||||||
@@ -153,10 +155,13 @@ impl Context {
|
|||||||
}
|
}
|
||||||
Err(err) => warn!(self, "cannot get highest quota usage: {:#}", err),
|
Err(err) => warn!(self, "cannot get highest quota usage: {:#}", err),
|
||||||
}
|
}
|
||||||
}
|
Ok(quota)
|
||||||
|
} else {
|
||||||
|
Err(anyhow!(stock_str::not_supported_by_provider(self).await))
|
||||||
|
};
|
||||||
|
|
||||||
*self.quota.write().await = Some(QuotaInfo {
|
*self.quota.write().await = Some(QuotaInfo {
|
||||||
recent: quota,
|
recent: recent.cloned(),
|
||||||
modified: tools::Time::now(),
|
modified: tools::Time::now(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user