Last active
August 29, 2015 13:56
-
-
Save equinox79/9131669 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run_periodic | |
until @finished | |
begin | |
sleep @receive_interval | |
@queue.receive_message do |message| | |
record = {} | |
record[:body] = message.body.to_s | |
record[:handle] = message.handle.to_s | |
record[:id] = message.id.to_s | |
record[:md5] = message.md5.to_s | |
record[:url] = message.queue.url.to_s | |
record[:sender_id] = message.sender_id.to_s | |
//Engine.emit(@tag, Time.now, record) // これだとこける | |
Engine.emit(@tag, Time.now.to_i, record) // to_i をつけると動く | |
end | |
rescue | |
$log.error "failed to emit or receive", :error => $!.to_s, :error_class => $!.class.to_s | |
$log.warn_backtrace $!.backtrace | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment