Skip to content

refactor!: rework scheduled actions API#28

Merged
tisonkun merged 2 commits intomainfrom
rework
Apr 19, 2025
Merged

refactor!: rework scheduled actions API#28
tisonkun merged 2 commits intomainfrom
rework

Conversation

@tisonkun
Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
@tisonkun tisonkun merged commit 63ebad2 into main Apr 19, 2025
9 checks passed
@tisonkun tisonkun deleted the rework branch April 19, 2025 03:40
///
/// By default, this function returns a future that never resolves, i.e., the action will never
/// be shutdown.
fn is_shutdown(&self) -> impl Future<Output = ()> + Send {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No shutdown in Action since lieftime is tricky to handle. Follow axum's and poem's practice to pass a shutdown future that resolved to signal the action to shutdown.

I'd prefer to use a closure for geenrate the future each time but FnMut would face the issue as described in https://docs.rs/backon/latest/backon/trait.RetryableWithContext.html#example. And AsyncFnMut would hit the issue in rust-lang/rust#62290 (comment).

}

/// A teardown hook that is called when the action is shutdown.
fn teardown(&mut self) {}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sync teardown can be implemented in Action's Drop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant