다음을 통해 이메일을 보내고 싶습니다. delayed_job
하지만 이벤트 전후에 보내고 싶어요.
내 관심사는 이것이 실제로 작동하는지입니다.
def one_week_before_run
AtendeeMailer.delay(run_at: '8th October 2016'.to_datetime).mudrun_about_to_start(self)
end
def thank_you_note
AtendeeMailer.delay(run_at: '18th October 2016'.to_datetime.end_of_day).thank_you(self)
end
아니면 다른 접근 방식을 선택해야합니까?
지연된 작업은 run_at <= 현재 시간 인 경우에만 실행할 작업을 선택합니다. 작업을 선택하려면 DJ의 쿼리를 참조하십시오.
SELECT `delayed_jobs`.* FROM `delayed_jobs` WHERE ((run_at <= '2016-09-27 00:49:59' AND (locked_at IS NULL OR locked_at < '2016-09-27 00:24:59') OR locked_by = 'host:Madhubalans-Air pid:74314') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1
코드는 run_at를 2016-10-18 00:00:00 및 2016-10-18 23:59:59로 설정합니다. 따라서 코드는 예상대로 작동합니다. :)
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다