Skip to content

Commit bd2c3ec

Browse files
committed
fmt
1 parent c1d7c9a commit bd2c3ec

4 files changed

Lines changed: 20 additions & 25 deletions

File tree

crates/client-api/src/routes/database.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ pub struct CallFromDatabaseQuery {
236236
msg_id: u64,
237237
}
238238

239-
240239
/// Call a reducer on behalf of another database, with deduplication.
241240
///
242241
/// Endpoint: `POST /database/:name_or_identity/call-from-database/:reducer`
@@ -320,12 +319,10 @@ pub async fn call_from_database<S: ControlStateDelegate + NodeDelegate>(
320319
),
321320
// 422 = reducer ran but returned Err; the IDC actor uses this to distinguish
322321
// reducer failures from other errors (which it retries).
323-
ReducerOutcome::Failed(errmsg) => {
324-
(
325-
StatusCode::UNPROCESSABLE_ENTITY,
326-
axum::body::Body::from(errmsg.to_string()),
327-
)
328-
}
322+
ReducerOutcome::Failed(errmsg) => (
323+
StatusCode::UNPROCESSABLE_ENTITY,
324+
axum::body::Body::from(errmsg.to_string()),
325+
),
329326
// This will be retried by IDC acttor
330327
ReducerOutcome::BudgetExceeded => {
331328
log::warn!(

crates/core/src/host/idc_actor.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ use anyhow::anyhow;
1818
use bytes::Bytes;
1919
use spacetimedb_datastore::execution_context::{ReducerContext, Workload};
2020
use spacetimedb_datastore::locking_tx_datastore::MutTxId;
21-
use spacetimedb_datastore::system_tables::{
22-
StInboundMsgResultStatus, StOutboundMsgRow, ST_OUTBOUND_MSG_ID,
23-
};
21+
use spacetimedb_datastore::system_tables::{StInboundMsgResultStatus, StOutboundMsgRow, ST_OUTBOUND_MSG_ID};
2422
use spacetimedb_datastore::traits::IsolationLevel;
2523
use spacetimedb_lib::{AlgebraicValue, Identity, ProductValue};
2624
use spacetimedb_primitives::{ColId, TableId};
@@ -249,11 +247,15 @@ fn reducer_workload(module: &ModuleInfo, params: &CallReducerParams) -> Workload
249247
})
250248
}
251249

252-
fn duplicate_result_from_st_inbound_row(row: spacetimedb_datastore::system_tables::StInboundMsgRow) -> ReducerCallResult {
250+
fn duplicate_result_from_st_inbound_row(
251+
row: spacetimedb_datastore::system_tables::StInboundMsgRow,
252+
) -> ReducerCallResult {
253253
let outcome = match row.result_status {
254254
StInboundMsgResultStatus::Success => ReducerOutcome::Committed,
255255
StInboundMsgResultStatus::ReducerError => ReducerOutcome::Failed(Box::new(
256-
String::from_utf8_lossy(&row.result_payload).into_owned().into_boxed_str(),
256+
String::from_utf8_lossy(&row.result_payload)
257+
.into_owned()
258+
.into_boxed_str(),
257259
)),
258260
};
259261

@@ -344,11 +346,9 @@ where
344346
call_reducer(
345347
Some(tx),
346348
params,
347-
Box::new(move |tx, _reducer_return_value| {
348-
match action {
349-
ReducerSuccessActionKind::DeleteOutboundMsg(msg_id) => {
350-
tx.delete_outbound_msg(msg_id).map_err(|e| anyhow!(e))
351-
}
349+
Box::new(move |tx, _reducer_return_value| match action {
350+
ReducerSuccessActionKind::DeleteOutboundMsg(msg_id) => {
351+
tx.delete_outbound_msg(msg_id).map_err(|e| anyhow!(e))
352352
}
353353
}),
354354
)
@@ -428,7 +428,6 @@ async fn finalize_message(
428428
return;
429429
}
430430
Err(e) => {
431-
432431
delete_message(db, msg.msg_id);
433432
log::error!(
434433
"idc_actor: on_result reducer '{}' failed for msg_id={}: {e:?}",
@@ -438,7 +437,6 @@ async fn finalize_message(
438437
}
439438
}
440439
}
441-
442440
}
443441

444442
/// Load all messages from ST_OUTBOUND_MSG into the per-target queues, resolving delivery data
@@ -559,7 +557,9 @@ fn load_pending_into_targets(db: &RelationalDB, db_queues: &mut HashMap<Identity
559557
pending.sort_by_key(|m| m.msg_id);
560558

561559
for msg in pending {
562-
let state = db_queues.entry(msg.target_db_identity).or_insert_with(DatabaseQueue::new);
560+
let state = db_queues
561+
.entry(msg.target_db_identity)
562+
.or_insert_with(DatabaseQueue::new);
563563
// Only add if not already in the queue (avoid duplicates after reload).
564564
let already_queued = state.queue.iter().any(|m| m.msg_id == msg.msg_id);
565565
if !already_queued {

crates/core/src/host/v8/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,9 +1198,7 @@ async fn spawn_instance_worker(
11981198
|tx, params, on_success: crate::host::idc_actor::ReducerSuccessAction| {
11991199
instance_common.call_reducer_with_tx(tx, params, &mut inst, on_success)
12001200
};
1201-
let mut call_reducer = |tx, params| {
1202-
call_reducer_with_success(tx, params, Box::new(|_tx, _ret| Ok(())))
1203-
};
1201+
let mut call_reducer = |tx, params| call_reducer_with_success(tx, params, Box::new(|_tx, _ret| Ok(())));
12041202
let mut should_exit = false;
12051203

12061204
core_pinner.pin_if_changed();

crates/core/src/host/wasm_common/module_host_actor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,6 @@ impl<T: WasmInstance> WasmModuleInstance<T> {
514514
res
515515
}
516516

517-
518517
pub fn clear_all_clients(&self) -> anyhow::Result<()> {
519518
self.common.clear_all_clients()
520519
}
@@ -597,7 +596,8 @@ impl<T: WasmInstance> WasmModuleInstance<T> {
597596
F: FnOnce(&mut MutTxId, &Option<Bytes>) -> anyhow::Result<()>,
598597
{
599598
crate::callgrind_flag::invoke_allowing_callgrind(|| {
600-
self.common.call_reducer_with_tx(tx, params, &mut self.instance, on_success)
599+
self.common
600+
.call_reducer_with_tx(tx, params, &mut self.instance, on_success)
601601
})
602602
}
603603

0 commit comments

Comments
 (0)