Expand description
Email notifications for the email pusher kind.
A notifying event for a user with an email pusher wakes the worker, which waits out the configured delay and then mails every notification still unread in one message. The pending work is derived from the stored notification rows; only a cursor per pusher, and a throttle per room it has mailed about, are kept beside them, so a restart loses no pending mail of a pusher whose cursor has started.
Re-exportsΒ§
use std::collections::BTreeMap;πuse std::pin::pin;πuse std::time::Duration;πuse futures::FutureExt;πuse futures::StreamExt;πuse futures::future::Either;πuse futures::future::select;πuse futures::stream::unfold;πuse loole::Receiver;πuse loole::Sender;πuse loole::unbounded;πuse ruma::OwnedUserId;πuse ruma::UserId;πuse ruma::api::client::push::PusherKind;πuse ruma::api::client::push::set_pusher::v3::PusherAction;πuse tokio::time::Instant;πuse tokio::time::sleep_until;πuse tuwunel_core::Result;πuse tuwunel_core::implement;πuse tuwunel_core::result::NotFound;πuse tuwunel_core::smallstr::SmallString;πuse tuwunel_core::utils::MutexMap;πuse tuwunel_core::utils::MutexMapGuard;πuse tuwunel_core::utils::OptionExt;πuse tuwunel_core::utils::exponential_backoff_remaining;πuse tuwunel_core::utils::stream::TryIgnore;πuse tuwunel_core::utils::time::now_millis;πuse tuwunel_core::warn;πuse tuwunel_database::Deserialized;πuse tuwunel_database::Interfix;πuse tuwunel_database::Json;πpub use self::evaluate::Outcome;
ModulesΒ§
StructsΒ§
EnumsΒ§
- Next π
ConstantsΒ§
- BOOT_
GRACE π - The wait after startup before evaluating the pushers that had work.
- RETRY_
MAX π - RETRY_
MIN π - WAIT_
MAX π - The longest any pusher waits, whatever the configured delay.
FunctionsΒ§
- entry_
in π - kept_
frontier π - The frontier kept for a pusher whose cursor could not be started, if any.
- next_
entry π - The entry a pusher gets after an outcome, if any.
- pusher_
key π - reschedule π
- Applies an outcome to a pusher that fell due.
- woken π
- Adds a woken pusher, or brings its entry forward to the sooner due time.
Type AliasesΒ§
- Locks π
- Serializes the writes to each email pusherβs rows.
- PushKey π
- Pusher
Key π - One email pusher: its user, and its pushkey.
- Schedule π
- The email pushers with pending work and when each is next evaluated.
- Wake π
- The pusher one notification wakes, and the frontier of retired writes when the wake was sent.