Skip to main content

CleanupConfig

Struct CleanupConfig 

Source
pub struct CleanupConfig {
    pub task_retention_duration: Duration,
    pub enable_automatic_cleanup: bool,
    pub max_retained_tasks: usize,
}
Expand description

Configuration for completed-task retention.

The executor releases the state of finished tasks in whole blocks of 1,024 tasks as it registers new ones, so retained memory follows the spawn rate without a background thread. A block is released once every task in it has finished and either its newest completion is older than task_retention_duration or more than max_retained_tasks finished tasks are retained. One long-running task therefore keeps its own block resident.

A released task still reports as completed to wait_for_task and accepts cancel_task as a no-op; only its status and statistics are gone, so task_status and task_stats return None.

Fields§

§task_retention_duration: Duration

How long finished-task metadata stays observable.

§Default: 5 minutes

§enable_automatic_cleanup: bool

Whether the executor releases finished-task metadata at all.

When disabled every task’s metadata is retained for the executor’s lifetime and memory grows with the number of tasks spawned.

§Default: true

§max_retained_tasks: usize

Most finished tasks retained regardless of age, rounded up to whole blocks of 1,024 tasks.

This is the hard bound on retained memory for a workload that finishes tasks faster than task_retention_duration elapses.

§Default: 10,000 tasks

Trait Implementations§

Source§

impl Clone for CleanupConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CleanupConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CleanupConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.