ids为空时不需要执行

This commit is contained in:
guange 2016-12-27 21:40:14 +08:00
parent 2032ce8a3c
commit 5d4a3d8235
1 changed files with 2 additions and 0 deletions

View File

@ -225,6 +225,8 @@ class News < ActiveRecord::Base
vs << {course_message_type:'News',course_message_id:self.id, :user_id => m.user_id, vs << {course_message_type:'News',course_message_id:self.id, :user_id => m.user_id,
:course_id => self.course_id, :viewed => false} :course_id => self.course_id, :viewed => false}
#delayed_job卡住的原因是一次执行的条数太多导致超时。
#现在把每次只执行不超过30条就不会超了。
if vs.size >= 30 if vs.size >= 30
self.delay.contain_news_message(vs) self.delay.contain_news_message(vs)
vs.clear vs.clear