Sha256: e74c05a47c79aed9569ffcefed549818a31c747118f77781035d529a2d0aa938

Contents?: true

Size: 508 Bytes

Versions: 3

Compression:

Stored size: 508 Bytes

Contents

require 'concurrent'
require 'headsail/api'
require 'headsail/event'
require 'headsail/http'
require 'headsail/redis'

module Headsail
  class Task
    def initialize(config)
      @api = API.new(config)
      @redis = Redis.new(@api.name)
      @http = HTTP.new(@api)
      @event = Event.new(@api.name)
    end

    def run
      Concurrent::TimerTask.new(execution_interval: @api.timer) do
        @redis.add(@http.body) if @http.run
        @event.request(@http, @api.method)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
headsail-0.1.11 lib/headsail/task.rb
headsail-0.1.1 lib/headsail/task.rb
headsail-0.1.0 lib/headsail/task.rb