Small reordering

This commit is contained in:
Paul van Tilburg 2014-11-15 22:24:27 +01:00
parent 1f0bf617f0
commit e62df9bc36
1 changed files with 4 additions and 2 deletions

6
hued
View File

@ -363,12 +363,14 @@ rescue OptionParser::InvalidOption => e
abort opt_parser.to_s
end
# Create the main engine
hued = Hued.new(options)
# Handle signals
Signal.trap("INT") { EM.stop }
Signal.trap("TERM") { EM.stop }
# Create the main engine and trigger it periodically
hued = Hued.new(options)
# Trigger rule execution and light status refreshing periodically
EM.run do
EM.add_periodic_timer(10) { hued.reload; hued.execute }
EM.add_periodic_timer(300) { hued.refresh! }