From 9fd73855d2d8d0f969d6ff125799dbafde2378f0 Mon Sep 17 00:00:00 2001 From: pedrocarlo Date: Tue, 23 Sep 2025 22:40:10 -0300 Subject: [PATCH] after we generated all interactions if some connection is still in a transaction, commit --- simulator/generation/plan.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/simulator/generation/plan.rs b/simulator/generation/plan.rs index 6be223537..a8b4676d8 100644 --- a/simulator/generation/plan.rs +++ b/simulator/generation/plan.rs @@ -239,7 +239,16 @@ impl InteractionPlan { self.plan.push(interactions); Some(out_interactions) } else { - None + // after we generated all interactions if some connection is still in a transaction, commit + (0..env.connections.len()) + .find(|idx| env.conn_in_transaction(*idx)) + .map(|conn_index| { + let query = Query::Commit(Commit); + let interaction = Interactions::new(conn_index, InteractionsType::Query(query)); + let out_interactions = interaction.interactions(); + self.plan.push(interaction); + out_interactions + }) } } @@ -292,6 +301,7 @@ pub trait InteractionPlanIterator { } impl InteractionPlanIterator for &mut T { + #[inline] fn next(&mut self, env: &mut SimulatorEnv) -> Option { T::next(self, env) } @@ -332,6 +342,7 @@ impl InteractionPlanIterator for PlanIterator where I: Iterator, { + #[inline] fn next(&mut self, _env: &mut SimulatorEnv) -> Option { self.iter.next() }