Sha256: bff06d7677e9082260bc5133be9adef3728a6c21b120f146f5cb4a965983193b

Contents?: true

Size: 661 Bytes

Versions: 4

Compression:

Stored size: 661 Bytes

Contents

# frozen-string-literal: true

require 'clockwork'
require 'active_support/time'

module Rodbot
  class Services
    class Schedule

      def tasks(**)
        puts "Starting schedule service"
        [method(:run)]
      end

      private

      def run
        Clockwork.instance_eval do
          configure do |config|
            config[:tz] = Rodbot.config[:time_zone]
            config[:logger] = Rodbot::Log.logger('schedule')
          end
          handler { Rodbot::Async.perform(&_1) }
        end
        Rodbot.plugins.extend_schedule
        require Rodbot.env.root.join('config', 'schedule')
        Clockwork.run
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rodbot-0.4.5 lib/rodbot/services/schedule.rb
rodbot-0.4.4 lib/rodbot/services/schedule.rb
rodbot-0.4.3 lib/rodbot/services/schedule.rb
rodbot-0.4.2 lib/rodbot/services/schedule.rb