Digest Emails Not Sending to All Users – Need Help Debugging

@Canapin we have also not seen any documentation that points to this setting being related to email…it’s good to know where it is though @Heliosurge so thanks for pointing it out.

Another day without any digest created. We posted a new topic to trigger things in the last 24 hours and nothing…

Anyone have any other ideas here? Are we missing a log somewhere? Is something failing somewhere we can see and correct?

Thinking about this, we are assuming that the issue is related to the number of users in the system. What’s odd is this had not changed by more than 10 since launching on discourse.

We have roughly:

  • 1 million active users
  • 2.4 million deactivated users

Maybe there is some funny timeout occurring when the system does this lookup? Where would we see that output if it fails?

Again, seems odd that this would be the problem since the digest were sending, at least in some limited about a week or two ago.

1 Like

Perhaps, or something else that makes the digest empty, thus not sent to the users.

I don’t know how a digest is made. I don’t know if it takes into account categories ignored by the user, or stuff like that.

I suppose your users won’t receive the digest if you send it manually through the rails console?

user = User.find_by(username: 'user-name')
Jobs.enqueue(:user_email, type: :digest, user_id: user.id)

A few seconds after running this, you should see the Sidekiq processed jobs increased by 1, but if you have a large forum there might be a lot of Sidekiq jobs at any time, so it might be hard to see if it increased.
You can use the Live Poll button to see it in real-time:

From my test, if I run the rails script to send the digest to a user, but the digest is empty:

  • because the user received it earlier
  • or has disabled email summaries in their profile
  • etc…

Then the Sidekiq processed jobs number will increase by one, but no email will be sent, and there will be no new entry to /admin/email/sent.

Maybe you could log processed Sidekiq jobs to see if there’s any clue in it. I searched for a bit, but I’m not sure it logs what jobs have been processed by default.

I feel that there’s a logical, good explanation for why the users don’t receive the digest. The job might be processed, but the digest might be empty, which would explain why there’s no trace of it.
I would check thoroughly all the concerned users’ settings again, their notification levels, their tracked categories and stuff like that.

1 Like

It would be quite easy to add debugging output to the digest sending machinery.
Do you have a staging site available, where one can test without compromising your production instance?

There, one could test if timeouts in queries occur, for example. Naively, I would expect timeouts to be seen in the logs.

One could further enhance the query that builds the targeted people with statistical output.

All this is not difficult in a sandboxed environment but can be dangerous in production.

2 Likes