Sha256: 7e96d33b0aa571cc31217b725f6293a8201c6387c92cead8bfe5cfc54addbd99
Contents?: true
Size: 610 Bytes
Versions: 25
Compression:
Stored size: 610 Bytes
Contents
# frozen_string_literal: true module Dynflow module Middleware::Common class Singleton < Middleware # Each action tries to acquire its own lock before the action's #plan starts def plan(*args) action.singleton_lock! pass(*args) end # At the start of #run we try to acquire action's lock unless it already holds it # At the end the action tries to unlock its own lock if the execution plan has no # finalize phase def run(*args) action.singleton_lock! unless action.holds_singleton_lock? pass(*args) end end end end
Version data entries
25 entries across 25 versions & 1 rubygems