lib/nestene/actor/delayed_scheduler.rb in nestene-0.1.8 vs lib/nestene/actor/delayed_scheduler.rb in nestene-0.2.0

- old
+ new

@@ -11,11 +11,15 @@ subscribe('state_update', :update_schedule) @schedule = [] @timer = nil end + def schedule_struct + @schedule.to_structure + end + def update_schedule topic, auton_id, state @schedule.delete_if{|e| e.first == auton_id} state.queue.delayed.each do |d| @@ -49,10 +53,10 @@ if execute_in <= 0 method = ScheduledMethod.new(delayed) state.queue.to_execute << method end if delayed.every - delayed.execute_at += delayed.every + delayed.execute_at = now + delayed.every state.queue.add_delayed(delayed) end end else @schedule.unshift [auton_id, delayed_method]