Skip to content

Commit 013fed7

Browse files
committed
Only open the default store in set_initial_key_values when we have to
Signed-off-by: Caleb Schoepp <[email protected]>
1 parent 783775e commit 013fed7

File tree

1 file changed

+7
-1
lines changed
  • crates/runtime-config/src

1 file changed

+7
-1
lines changed

crates/runtime-config/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,20 @@ where
118118
&self,
119119
initial_key_values: impl IntoIterator<Item = &(String, String)>,
120120
) -> anyhow::Result<()> {
121+
// We don't want to unnecessarily interact with the default store
122+
let mut iter = initial_key_values.into_iter().peekable();
123+
if iter.peek().is_none() {
124+
return Ok(());
125+
}
126+
121127
let store = self
122128
.key_value_resolver
123129
.default(DEFAULT_KEY_VALUE_STORE_LABEL)
124130
.expect("trigger was misconfigured and lacks a default store")
125131
.get(DEFAULT_KEY_VALUE_STORE_LABEL)
126132
.await
127133
.expect("trigger was misconfigured and lacks a default store");
128-
for (key, value) in initial_key_values {
134+
for (key, value) in iter {
129135
store
130136
.set(key, value.as_bytes())
131137
.await

0 commit comments

Comments
 (0)