lib/dynflow/world/invalidation.rb
# Invalidate another world, that left some data in the runtime,
# but it's not really running
#
# @param world [Coordinator::ClientWorld, Coordinator::ExecutorWorld] coordinator record
#   left behind by the world we're trying to invalidate
# @return [void]
Invalidate another world, that left some data in the runtime,
but it's not really running
Invalidate another world that left some data in the runtime but it ' s not really running
def invalidate(world)
        Type! world, Coordinator::ClientWorld, Coordinator::ExecutorWorld
        coordinator.acquire(Coordinator::WorldInvalidationLock.new(self, world)) do
          coordinator.find_locks(class: Coordinator::PlanningLock.name,
                                 owner_id: 'world:' + world.id).each do |lock|
            invalidate_planning_lock lock
          end
          if world.is_a? Coordinator::ExecutorWorld
            old_execution_locks = coordinator.find_locks(class: Coordinator::ExecutionLock.name,
                                                         owner_id: "world:#{world.id}")
            coordinator.deactivate_world(world)
            old_execution_locks.each do |execution_lock|
              invalidate_execution_lock(execution_lock)
            end
          end
          pruned = persistence.prune_envelopes(world.id)
          logger.error("Pruned #{pruned} envelopes for invalidated world #{world.id}") unless pruned.zero?
          coordinator.delete_world(world)
        end
      end
def invalidate ( world ) Type! world , Coordinator :: ClientWorld , Coordinator :: ExecutorWorld coordinator . acquire ( Coordinator :: WorldInvalidationLock . new ( self , world ) ) do coordinator . find_locks ( class : Coordinator :: PlanningLock . name , owner_id : 'world:' + world . id ) . each do | lock | invalidate_planning_lock lock end if world . is_a? Coordinator :: ExecutorWorld old_execution_locks = coordinator . find_locks ( class : Coordinator :: ExecutionLock . name , owner_id : "world:#{world.id}" ) coordinator . deactivate_world ( world ) old_execution_locks . each do | execution_lock | invalidate_execution_lock ( execution_lock ) end end pruned = persistence . prune_envelopes ( world . id ) logger . error ( "Pruned #{pruned} envelopes for invalidated world #{world.id}" ) unless pruned . zero? coordinator . delete_world ( world ) end end
Invalidate another world, that left some data in the runtime,
but it's not really running
Invalidate another world that left some data in the runtime but it ' s not really running
None
void
world
coordinator record left behind by the world we're trying to invalidate
coordinator record left behind by the world we ' re trying to invalidate