class ActiveHook::Server::HookRunner

Public Class Methods

new(json) click to toggle source
# File lib/activehook/server/queue.rb, line 37
def initialize(json)
  @hook = Hook.new(JSON.parse(json))
  @post = Send.new(hook: @hook)
  start
end

Public Instance Methods

start() click to toggle source
# File lib/activehook/server/queue.rb, line 43
def start
  @post.start
  ActiveHook.redis.with do |conn|
    @post.success? ? hook_success(conn) : hook_failed(conn)
  end
end

Private Instance Methods

hook_failed(conn) click to toggle source
# File lib/activehook/server/queue.rb, line 56
def hook_failed(conn)
  conn.zadd('ah:retry', @hook.retry_at, @hook.to_json) if @hook.retry?
  conn.incr('ah:total_failed')
end
hook_success(conn) click to toggle source
# File lib/activehook/server/queue.rb, line 52
def hook_success(conn)
  conn.incr('ah:total_success')
end