Skip to content

Commit

Permalink
Run should not be private
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Mar 23, 2011
1 parent cb7c525 commit 2816950
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
34 changes: 17 additions & 17 deletions lib/minion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,23 @@ def logger(&block)
@logging = block
end

# Runs the minion subscribers.
#
# @example Run the subscribers.
# Minion.run
def run
info("Starting minion")
Signal.trap("INT") { AMQP.stop { EM.stop } }
Signal.trap("TERM") { AMQP.stop { EM.stop } }

EM.run do
AMQP.start(amqp_config) do
MQ.prefetch(1)
check_handlers
end
end
end

# Get the url for the amqp server.
#
# @example Get the url.
Expand Down Expand Up @@ -211,22 +228,5 @@ def error_handling
def logging
@logging ||= ->(msg) { puts("#{Time.now} :minion: #{msg}") }
end

# Runs the minion subscribers.
#
# @example Run the subscribers.
# Minion.run
def run
info("Starting minion")
Signal.trap("INT") { AMQP.stop { EM.stop } }
Signal.trap("TERM") { AMQP.stop { EM.stop } }

EM.run do
AMQP.start(amqp_config) do
MQ.prefetch(1)
check_handlers
end
end
end
end

4 changes: 2 additions & 2 deletions lib/minion/handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ def initialize(queue)
@sub = lambda {}
@unsub = lambda {}
@on = false
end
end

def should_sub?
@when.call
end
end

def check
if should_sub?
Expand Down

0 comments on commit 2816950

Please sign in to comment.