Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[ISSUE #2419] Adding #[inline] for RocketMQRuntime method #2420

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions rocketmq-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub enum RocketMQRuntime {
}

impl RocketMQRuntime {
#[inline]
pub fn new_multi(threads: usize, name: &str) -> Self {
Self::Multi(
tokio::runtime::Builder::new_multi_thread()
Expand All @@ -35,30 +36,35 @@ impl RocketMQRuntime {
}

impl RocketMQRuntime {
#[inline]
pub fn get_handle(&self) -> &tokio::runtime::Handle {
match self {
Self::Multi(runtime) => runtime.handle(),
}
}

#[inline]
pub fn get_runtime(&self) -> &tokio::runtime::Runtime {
match self {
Self::Multi(runtime) => runtime,
}
}

#[inline]
pub fn shutdown(self) {
match self {
Self::Multi(runtime) => runtime.shutdown_background(),
}
}

#[inline]
pub fn shutdown_timeout(self, timeout: Duration) {
match self {
Self::Multi(runtime) => runtime.shutdown_timeout(timeout),
}
}

#[inline]
pub fn schedule_at_fixed_rate<F>(
&self,
task: F,
Expand Down Expand Up @@ -93,6 +99,7 @@ impl RocketMQRuntime {
}
}

#[inline]
pub fn schedule_at_fixed_rate_mut<F>(
&self,
mut task: F,
Expand Down
Loading