asitmoharna
asitmoharna

Reputation: 1532

Heroku: delayed job sending email multiple times

We have one application(Rails 3) deployed in Heroku. For sending email digest to nearly about 500 users, we are using delayed_job.

Notifier.delay.send_email_digest(digest_content, @user)

My application has 3 web dynos and 2 worker dynos. Though the task is sending only one Email digest per user in local, In heroku (production) it's sending two email digests for some users (strange).

Is it due to two worker dynos (but why?? or mere coincidence). Can anybody help me solve the problem?

Thanks.

Upvotes: 1

Views: 1206

Answers (1)

anthonator
anthonator

Reputation: 5191

Within your send_email_digest method are you calling deliver? Delayed Job uses some magic when sending emails and it will automatically call deliver for you. If you call deliver yourself it will send multiple times. I've had this happen on occasion.

Upvotes: 5

Related Questions