time-exchange-gr / oscurrency

Open Source Time Exchange derived from Insoshi
http://time-exchange.gr
Other
9 stars 0 forks source link

manic / depressive forum notifications #21

Open 3point2 opened 12 years ago

3point2 commented 12 years ago

some people (e.g. me) are getting the same message notification many (e.g. 14) times. others (e.g. Thanasi) didn't receive the same notification at all. this may be because I killed all delayed jobs to stop the spamming and it didn't get a change to send to certain users.

i dumped a bunch of information from the jobs before destroying them which i'll upload soon.

3point2 commented 12 years ago

i have the failed emails figured out. this is the traceback i got from the .last_error attribute of the Delayed::Job

Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
/app/app/models/forum_post.rb:50:in `do_send_forum_notifications'
/app/app/models/forum_post.rb:49:in `each'
/app/app/models/forum_post.rb:49:in `do_send_forum_notifications'
/app/app/models/forum_post.rb:43:in `perform'
/app/vendor/plugins/delayed_job/lib/delayed/job.rb:217:in `invoke_job'
/app/vendor/plugins/delayed_job/lib/delayed/job.rb:92:in `run_with_lock'
/usr/ruby1.8.7/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/app/vendor/plugins/delayed_job/lib/delayed/job.rb:91:in `run_with_lock'
/app/vendor/plugins/delayed_job/lib/delayed/job.rb:155:in `reserve_and_run_one_job'
/app/vendor/plugins/delayed_job/lib/delayed/job.rb:154:in `each'
/app/vendor/plugins/delayed_job/lib/delayed/job.rb:154:in `reserve_and_run_one_job'
/app/vendor/plugins/delayed_job/lib/delayed/job.rb:201:in `work_off'
/app/vendor/plugins/delayed_job/lib/delayed/job.rb:200:in `times'
/app/vendor/plugins/delayed_job/lib/delayed/job.rb:200:in `work_off'
/app/vendor/plugins/delayed_job/lib/delayed/worker.rb:28:in `start'
/usr/ruby1.8.7/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/app/vendor/plugins/delayed_job/lib/delayed/worker.rb:27:in `start'
/app/vendor/plugins/delayed_job/lib/delayed/worker.rb:24:in `loop'
/app/vendor/plugins/delayed_job/lib/delayed/worker.rb:24:in `start'
/app/vendor/plugins/delayed_job/tasks/tasks.rb:13
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/ruby1.8.7/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:62:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/app/.bundle/gems/ruby/1.8/gems/rake-0.9.2/bin/rake:32
/usr/ruby1.8.7/bin/rake:19:in `load'
/usr/ruby1.8.7/bin/rake:19

do_send_forum_notifications does peeps = topic.forum.group.memberships.listening.map {|m| m.person} however, some of the memberships were missing a .person, and the subsequent code was not expecting a nil instead of a Person. the personless memberships were created when we deleted two users (see #13 ).

i've deleted the offending membership objects so we should be OK again for now.

i'm going to think on the best way to fix this. probably making person deletion cascade to the membership objects and changing the code that sends emails to cope with nils better should be fine.

jsalatas commented 12 years ago

I also noticed this happening some days ago. Unfortunately I cannot reproduce it in a development environment however it doesn't seem to happen anymore.