Sha256: ecd9d564afa0fb66bc29c4c4a28726f85027c0f2feb54d7141f972d01621bf0c

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

module Ni::Tools
  class Timers
    def self.fetch_and_run(metadata_repository_klass, exceptions_logger=nil)
      current_timers = metadata_repository_klass.fetch_timers
      exceptions = []

      current_timers.each do |data|
        id, klass_name, action, system_uid = data

        begin
          klass_name.constantize.public_send(action, system_uid: system_uid)
        rescue Exception => e
          exceptions << e
        ensure
          metadata_repository_klass.clear_timer!(id)
        end  
      end

      if exceptions_logger.present? && exceptions.present?
        exceptions.each { |e| exceptions_logger.log(e) }
      end  
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ni-0.1.1 lib/ni/tools/timers.rb