Skip to content

Commit d6cccca

Browse files
committed
fix: parallelize publish signal awaits
1 parent 3acf83e commit d6cccca

File tree

1 file changed

+9
-12
lines changed
  • engine/packages/gasoline/src/db/kv

1 file changed

+9
-12
lines changed

engine/packages/gasoline/src/db/kv/mod.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,17 @@ impl DatabaseKv {
142142
);
143143

144144
let workflow_name_key = keys::workflow::NameKey::new(workflow_id);
145+
let wake_signal_key =
146+
keys::workflow::WakeSignalKey::new(workflow_id, signal_name.to_string());
147+
148+
let (workflow_name_entry, wake_signal_entry) = tokio::try_join!(
149+
tx.get(&self.subspace.pack(&workflow_name_key), Serializable),
150+
tx.get(&self.subspace.pack(&wake_signal_key), Serializable),
151+
)?;
145152

146153
// TODO: This does not check if the workflow is silenced
147154
// Check if the workflow exists
148-
let Some(workflow_name_entry) = tx
149-
.get(&self.subspace.pack(&workflow_name_key), Serializable)
150-
.await?
151-
else {
155+
let Some(workflow_name_entry) = workflow_name_entry else {
152156
return Err(WorkflowError::WorkflowNotFound.into());
153157
};
154158

@@ -200,15 +204,8 @@ impl DatabaseKv {
200204
&workflow_id_key.serialize(workflow_id)?,
201205
);
202206

203-
let wake_signal_key =
204-
keys::workflow::WakeSignalKey::new(workflow_id, signal_name.to_string());
205-
206207
// If the workflow currently has a wake signal key for this signal, wake it
207-
if tx
208-
.get(&self.subspace.pack(&wake_signal_key), Serializable)
209-
.await?
210-
.is_some()
211-
{
208+
if wake_signal_entry.is_some() {
212209
let mut wake_condition_key = keys::wake::WorkflowWakeConditionKey::new(
213210
workflow_name,
214211
workflow_id,

0 commit comments

Comments
 (0)