From a15cd2088e170eb04bfa74d79ba84edbee338127 Mon Sep 17 00:00:00 2001 From: Adam Ruzicka Date: Mon, 12 Feb 2024 17:39:31 +0100 Subject: [PATCH] Perform invalidation of orphaned locks World invalidation previously relied on world-level lock being present. All locks belonging to the world which left that lock around would then be invalidated. If there were any orphaned locks, those would be just deleted. With this change, we do proper invalidation for orphaned locks. --- lib/dynflow/world/invalidation.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/dynflow/world/invalidation.rb b/lib/dynflow/world/invalidation.rb index f8ec7d87..069ed25b 100644 --- a/lib/dynflow/world/invalidation.rb +++ b/lib/dynflow/world/invalidation.rb @@ -117,7 +117,14 @@ def with_valid_execution_plan_for_lock(execution_lock) # @return [Integer] number of invalidated worlds def perform_validity_checks world_invalidation_result = worlds_validity_check - locks_validity_check + locks_validity_check.each do |lock| + case lock + when ::Dynflow::Coordinator::PlanningLock + invalidate_planning_lock(lock) + when ::Dynflow::Coordinator::ExecutionLock + invalidate_execution_lock(lock) + end + end pruned = connector.prune_undeliverable_envelopes(self) logger.error("Pruned #{pruned} undeliverable envelopes") unless pruned.zero? world_invalidation_result.values.select { |result| result == :invalidated }.size