Skip to content

Commit 25876bb

Browse files
authored
fix: respect enable_cache (#879)
1 parent a55d3ea commit 25876bb

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

src/execution/evaluator.rs

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -354,24 +354,31 @@ async fn evaluate_op_scope(
354354
let mut input_values = Vec::with_capacity(op.inputs.len());
355355
input_values
356356
.extend(assemble_input_values(&op.inputs, scoped_entries).collect::<Vec<_>>());
357-
let output_value_cell = memory.get_cache_entry(
358-
|| {
359-
Ok(op
360-
.function_exec_info
361-
.fingerprinter
362-
.clone()
363-
.with(&input_values)?
364-
.into_fingerprint())
365-
},
366-
&op.function_exec_info.output_type,
367-
/*ttl=*/ None,
368-
)?;
369-
let output_value = evaluate_with_cell(output_value_cell.as_ref(), move || {
370-
op.executor.evaluate(input_values)
371-
})
372-
.await
373-
.with_context(|| format!("Evaluating Transform op `{}`", op.name,))?;
374-
head_scope.define_field(&op.output, &output_value)?;
357+
if op.function_exec_info.enable_cache {
358+
let output_value_cell = memory.get_cache_entry(
359+
|| {
360+
Ok(op
361+
.function_exec_info
362+
.fingerprinter
363+
.clone()
364+
.with(&input_values)?
365+
.into_fingerprint())
366+
},
367+
&op.function_exec_info.output_type,
368+
/*ttl=*/ None,
369+
)?;
370+
evaluate_with_cell(output_value_cell.as_ref(), move || {
371+
op.executor.evaluate(input_values)
372+
})
373+
.await
374+
.and_then(|v| head_scope.define_field(&op.output, &v))
375+
} else {
376+
op.executor
377+
.evaluate(input_values)
378+
.await
379+
.and_then(|v| head_scope.define_field(&op.output, &v))
380+
}
381+
.with_context(|| format!("Evaluating Transform op `{}`", op.name,))?
375382
}
376383

377384
AnalyzedReactiveOp::ForEach(op) => {

0 commit comments

Comments
 (0)