Skip to content

Commit

Permalink
Use take rather than get
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles committed Jan 23, 2024
1 parent 5081217 commit b814133
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub(crate) fn start_job_if_required(state: &RuntimeState) -> bool {

pub(crate) fn try_run_now(state: &mut RuntimeState) -> bool {
if let Some(batch) = next_batch(state) {
if let Some(timer_id) = TIMER_ID.get() {
if let Some(timer_id) = TIMER_ID.take() {
ic_cdk_timers::clear_timer(timer_id);
}
ic_cdk::spawn(process_batch(batch));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub(crate) fn start_job_if_required(state: &RuntimeState) -> bool {

pub(crate) fn try_run_now(state: &mut RuntimeState) -> bool {
if let Some((canister_id, events)) = next_batch(state) {
if let Some(timer_id) = TIMER_ID.get() {
if let Some(timer_id) = TIMER_ID.take() {
ic_cdk_timers::clear_timer(timer_id);
}
ic_cdk::spawn(sync_events(canister_id, events));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub(crate) fn start_job_if_required(state: &RuntimeState) -> bool {

pub(crate) fn try_run_now_for_canister(state: &mut RuntimeState, canister_id: CanisterId) -> bool {
if let Some(events) = state.data.user_canister_events_queue.try_start_for_canister(canister_id) {
if let Some(timer_id) = TIMER_ID.get() {
if let Some(timer_id) = TIMER_ID.take() {
ic_cdk_timers::clear_timer(timer_id);
}
ic_cdk::spawn(process_batch(vec![(canister_id, events)]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub(crate) fn start_job_if_required(state: &RuntimeState) -> bool {

pub(crate) fn try_run_now(state: &mut RuntimeState) -> bool {
if let Some(batch) = next_batch(state) {
if let Some(timer_id) = TIMER_ID.get() {
if let Some(timer_id) = TIMER_ID.take() {
ic_cdk_timers::clear_timer(timer_id);
}
ic_cdk::spawn(process_batch(batch));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub(crate) fn start_job_if_required(state: &RuntimeState) -> bool {

pub(crate) fn try_run_now(state: &mut RuntimeState) -> bool {
if let Some((canister_id, users)) = next_batch(state) {
if let Some(timer_id) = TIMER_ID.get() {
if let Some(timer_id) = TIMER_ID.take() {
ic_cdk_timers::clear_timer(timer_id);
}
ic_cdk::spawn(sync_users(canister_id, users));
Expand Down

0 comments on commit b814133

Please sign in to comment.