Changeset 158
- Timestamp:
- 04/27/08 23:38:50 (2 years ago)
- Location:
- zadolbator/lib/zadolbator
- Files:
-
- 2 modified
-
component.rb (modified) (1 diff)
-
worker_thread.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
zadolbator/lib/zadolbator/component.rb
r154 r158 192 192 end 193 193 end 194 puts iq195 puts "####"196 194 iq.to, iq.from = iq.from, iq.to 197 195 send(iq) -
zadolbator/lib/zadolbator/worker_thread.rb
r154 r158 30 30 31 31 def send_reminder(info) 32 puts "SENDING REMINDER #{info.inspect}"33 32 e = Storage::Event.find(info[:uid]) 34 33 @component.log.debug("Sending reminder #{info[:uid]} to #{e.owner.id}") … … 36 35 37 36 msg.body = "#{e.datetime} - #{e.title}\n#{e.description}" 38 puts msg.inspect39 37 @component.send(msg) 40 38 end … … 43 41 def fill_occurences(date_start) 44 42 date_end = date_start + @component.reminder_conf['queue_interval'] 45 puts date_end.strftime("%c")46 43 @occurs.clear 47 44 Storage::Event.find(:all, :conditions => {:alarm => date_start..(date_start+@component.reminder_conf['queue_interval']) } ).each { |e| … … 61 58 if not @occurs.empty? 62 59 @component.log.debug("First time: #{@occurs.first[:time]}") 63 puts "TEST"64 puts @occurs.first[:time].to_s < now.to_s65 puts @occurs.empty?66 puts "BEGIN WHILE"67 60 while not @occurs.empty? and @occurs.first[:time] <= now 68 puts "*******"69 61 send_reminder(@occurs.shift) 70 62 end 71 puts "END WHILE"72 63 end 73 64 fill_occurences(now) if @next_fill_date <= now 74 65 @current_date = now 75 66 } 76 puts "####"77 puts @component.reminder_conf['check_interval']78 67 sleep(@component.reminder_conf['check_interval']) 79 puts "$$$$"80 68 end 81 69 end
