class Rufus::Scheduler

def step_trigger


cron jobs.
triggers every eligible pending jobs, then every eligible
def step_trigger
    now = Time.new
    if @exit_when_no_more_jobs
       if @pending_jobs.size < 1
            @stopped = true
            return
        end
        @dont_reschedule_every = true if at_job_count < 1
    end
    # TODO : eventually consider running cron / pending
    # job triggering in two different threads
    #
    # but well... there's the synchronization issue...
    #
    # cron jobs
    if now.sec != @last_cron_second
        @last_cron_second = now.sec
        #puts "step() @cron_jobs.size #{@cron_jobs.size}"
        @cron_jobs.each do |cron_id, cron_job|
            #puts "step() cron_id : #{cron_id}"
            trigger(cron_job) if cron_job.matches?(now)
        end
    end
    #
    # pending jobs
    now = now.to_f
        #
        # that's what at jobs do understand
    loop do
        break if @pending_jobs.length < 1
        job = @pending_jobs[0]
        break if job.at > now
        #if job.at <= now
            #
            # obviously
        trigger job
        @pending_jobs.delete_at 0
    end
end