Method: Sensu::Server::Process#schedule_check_cron_request
- Defined in:
- lib/sensu/server/process.rb
#schedule_check_cron_request(check) ⇒ Object
Schedule a check request, using the check cron. This method determines the time until the next cron time (in seconds) and creats an EventMachine timer for the request. This method will be called after every check cron request for subsequent requests. The timer is stored in the timer hash under ‘:tasks`, so it can be cancelled etc. The check cron request timer object is removed from the timer hash after the request is published, to stop the timer hash from growing infinitely.
964 965 966 967 968 969 970 971 |
# File 'lib/sensu/server/process.rb', line 964 def schedule_check_cron_request(check) cron_time = determine_check_cron_time(check) @timers[:tasks][:check_request_publisher] << EM::Timer.new(cron_time) do |timer| create_check_request_proc(check).call @timers[:tasks][:check_request_publisher].delete(timer) schedule_check_cron_request(check) end end |