Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
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
19 changes: 15 additions & 4 deletions 19 crates/core/src/host/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,11 @@ fn call_scheduled_reducer_until_done(
let tx = db.begin_mut_tx(IsolationLevel::Serializable, Workload::Internal);

let params = reducer_call_params_for_queued_item(module_info, db, &tx, item);
let params = match params {
let (timestamp, instant, params) = match params {
// If the function was already deleted, leave the `ScheduledFunction`
// in the database for when the module restarts.
Ok(None) => return (CallScheduledFunctionResult { reschedule: None }, false),
Ok(Some((_timestamp, _instant, params))) => params,
Ok(Some(params)) => params,
Err(err) => {
// All we can do here is log an error.
log::error!("could not determine scheduled reducer or its parameters: {err:#}");
Expand All @@ -561,7 +561,16 @@ fn call_scheduled_reducer_until_done(
}
};

call_scheduled_reducer_with_tx(module_info, db, id, tx, params, inst_common, inst)
call_scheduled_reducer_with_tx(
module_info,
db,
id,
tx,
Some((timestamp, instant)),
params,
inst_common,
inst,
)
}

fn scheduled_item_id(item: &QueueItem) -> Option<ScheduledFunctionId> {
Expand All @@ -571,11 +580,13 @@ fn scheduled_item_id(item: &QueueItem) -> Option<ScheduledFunctionId> {
}
}

#[allow(clippy::too_many_arguments)]
fn call_scheduled_reducer_with_tx(
module_info: &ModuleInfo,
db: &RelationalDB,
id: Option<ScheduledFunctionId>,
mut tx: MutTxId,
reschedule_from: Option<(Timestamp, Instant)>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same question/suggestion here.

params: CallReducerParams,
inst_common: &mut InstanceCommon,
inst: &mut impl WasmInstance,
Expand Down Expand Up @@ -605,7 +616,7 @@ fn call_scheduled_reducer_with_tx(
let result = panic::catch_unwind(panic::AssertUnwindSafe(|| {
inst_common.call_reducer_with_tx(Some(tx), params, inst)
}));
let reschedule = delete_scheduled_function_row(module_info, db, id, None, None, inst_common, inst);
let reschedule = delete_scheduled_function_row(module_info, db, id, None, reschedule_from, inst_common, inst);
Comment on lines -608 to +619

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the absence of a test, could we change the type signature to always take an explicit timestamp instead of an option?

// Currently, we drop the return value from the function call. In the future,
// we might want to handle it somehow.
let trapped = match result {
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.