Skip to content

Commit bcb3bf7

Browse files
Arc instead of boxing scheduled function name
1 parent 35263db commit bcb3bf7

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

crates/core/src/host/instance_env.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,13 @@ impl InstanceEnv {
401401
table_id: TableId,
402402
row_ptr: RowPointer,
403403
) -> Result<(), NodesError> {
404-
let function_name: Box<str> = {
404+
let function_name: Arc<str> = {
405405
let table = stdb.schema_for_table_mut(tx, table_id)?;
406406
let schedule = table
407407
.schedule
408408
.as_ref()
409409
.expect("schedule_row should only be called for scheduled tables");
410-
(&schedule.function_name[..]).into()
410+
Arc::from(&schedule.function_name[..])
411411
};
412412
let (id_column, at_column) = stdb
413413
.table_scheduled_id_and_at(tx, table_id)?

crates/core/src/host/scheduler.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ enum MsgOrExit<T> {
5353
enum SchedulerMessage {
5454
Schedule {
5555
id: ScheduledFunctionId,
56-
function_name: Box<str>,
56+
function_name: Arc<str>,
5757
/// The timestamp we'll tell the reducer it is.
5858
effective_at: Timestamp,
5959
/// The actual instant we're scheduling for.
@@ -103,7 +103,8 @@ impl SchedulerStarter {
103103
// Find all Scheduled tables
104104
for st_scheduled_row in self.db.iter(&tx, ST_SCHEDULED_ID)? {
105105
let table_id = st_scheduled_row.read_col(StScheduledFields::TableId)?;
106-
let function_name = st_scheduled_row.read_col::<Box<str>>(StScheduledFields::ReducerName)?;
106+
let function_name =
107+
Arc::<str>::from(st_scheduled_row.read_col::<Box<str>>(StScheduledFields::ReducerName)?);
107108
let (id_column, at_column) = self
108109
.db
109110
.table_scheduled_id_and_at(&tx, table_id)?
@@ -210,7 +211,7 @@ impl Scheduler {
210211
schedule_at: ScheduleAt,
211212
id_column: ColId,
212213
at_column: ColId,
213-
function_name: Box<str>,
214+
function_name: Arc<str>,
214215
fn_start: Timestamp,
215216
) -> Result<(), ScheduleError> {
216217
// if `Timestamp::now()` is properly monotonic, use it; otherwise, use
@@ -279,7 +280,7 @@ struct SchedulerActor {
279280
enum QueueItem {
280281
Id {
281282
id: ScheduledFunctionId,
282-
function_name: Box<str>,
283+
function_name: Arc<str>,
283284
at: Timestamp,
284285
},
285286
VolatileNonatomicImmediate {

0 commit comments

Comments
 (0)