falcon
falcon copied to clipboard
How to start periodically task inside falcon?
I am going to build all-in-one application: web, RMQ consumer, periodically tasks, etc. I can't understand how to do it with falcon. I can't access Asyc::Task.current
directly, because it is not initialized inside config.ru. Could you explain how can I do that?
@sergio-fry I guess this is no longer relevant but let me just leave it here.
https://github.com/socketry/timers
require 'timers'
timers = Timers::Group.new
five_second_timer = timers.after(5) { puts "Take five" }
every_five_seconds = timers.every(5) { puts "Another 5 seconds" }
loop { timers.wait }
We can probably change this so that the config.ru is constructed within the top level async block... let me check.
@webgago thanks!