My installation isn't sending out digests


(Felix Freiberger) #1

I’m running a Discourse installation for a lecture, and I’ve configured my installation to send out daily digests by default.

However, only a single user has received digests so far, and I don’t know why. Here’s what I checked:

  • No other digests have been logged.
  • My test user hasn’t received any digests.
  • All my users started at TL1, so no posts should be excluded for being TL0.
  • The Digest preview in the admin area works as expected.
  • Most of my users have digests enabled and the frequency set to daily, per default.
  • Sidekiq is happy, and Jobs::EnqueueDigestEmails ran recently and was OK.

The single user who has received digests so far has increased the digest interval to three days. There are a few other users who have increased it to a week, but they might have visited the forum regularly enough to not trigger these digests.

I’m now wondering whether there’s a bug preventing weekly digests / digests with the default interval from going through. Is there any other reason for Discourse not to send out digests?


(Jeff Atwood) #2

Remember digests are only sent to users who have not visited in the given time interval.


(Felix Freiberger) #3

I have over 100 users – you are highly overestimating the diligence of German students :wink:
I’m 100% certain that many users have visited the forum only once so far.


(Jeff Atwood) #4

Dunno – sign up as a user yourself and see what kinds of emails you get. Could be a translation error, if it is not in english, those have been known to mess up certain code paths.


(Felix Freiberger) #5

I have a test user that hasn’t logged in for long enough to trigger an email.

That sound plausible, I’m running in German. Is there anything I can do to test this?


(Felix Freiberger) #6

Here’s a possibly related log entry:

Message
Job exception: wrong number of arguments (2 for 1)

Backtrace
/var/www/discourse/app/helpers/user_notifications_helper.rb:68:in `format_for_email'
/var/www/discourse/app/views/email/_post.html.erb:26:in `_app_views_email__post_html_erb___435990000182391029_70316138982300'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/template.rb:145:in `block in render'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:166:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/template.rb:333:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/template.rb:143:in `render'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/partial_renderer.rb:339:in `render_partial'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/partial_renderer.rb:310:in `block in render'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/partial_renderer.rb:309:in `render'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/renderer.rb:51:in `render_partial'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/renderer.rb:25:in `render'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/helpers/rendering_helper.rb:32:in `render'
/var/www/discourse/app/views/email/notification.html.erb:5:in `_app_views_email_notification_html_erb__3886662635068540083_70316138903940'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/template.rb:145:in `block in render'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:166:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/template.rb:333:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/template.rb:143:in `render'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/template_renderer.rb:52:in `render_template'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/template_renderer.rb:14:in `render'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/renderer.rb:46:in `render_template'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/renderer/renderer.rb:27:in `render'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/helpers/rendering_helper.rb:32:in `render'
/var/www/discourse/app/mailers/user_notifications.rb:344:in `send_notification_email'
/var/www/discourse/app/mailers/user_notifications.rb:268:in `notification_email'
/var/www/discourse/app/mailers/user_notifications.rb:138:in `user_linked'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:198:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:19:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:137:in `process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/rendering.rb:30:in `process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:596:in `block in process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:593:in `process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:584:in `initialize'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.6/lib/action_mailer/message_delivery.rb:25:in `new'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.6/lib/action_mailer/message_delivery.rb:25:in `__getobj__'
/usr/local/lib/ruby/2.0.0/delegate.rb:70:in `method_missing'
/var/www/discourse/lib/email/sender.rb:30:in `send'
/var/www/discourse/app/jobs/regular/user_email.rb:41:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

Env
hostname	pseuco-discourse-app
process_id	8929
application_version	d61fcbbb9d40bb495f5b1adc7f14e4877d554cfb
current_db	default
current_hostname	discourse.pseuco.com
job	Jobs::UserEmail
problem_db	default
opts	
type	user_linked
user_id	8
notification_id	708
notification_type	linked
post_id	258
current_site_id	default
notification_data_hash	
topic_title	[redacted]
original_post_id	258
original_post_type	1
original_username	felix.freiberger
display_username	felix.freiberger

(Jeff Atwood) #7

Are you on latest? If that is on latest @techapj can you have a look?


(Felix Freiberger) #8

I’m on the latest beta release: Discourse 1.6.0.beta2 - https://github.com/discourse/discourse version 2ec92021e1c801a15ed91906e64a826360c01f4c

I’ve only installed the default plugins, official ones, @cpradio’s checklist plugin and a custom one that only implements a custom onebox, nothing else.


(Sam Saffron) #9

This has got to be either a bad patch or old version:

erb file

 <td class='body'><%= format_for_email(post, use_excerpt) %></td>

helper

  def format_for_email(post, use_excerpt)
    html = use_excerpt ? post.excerpt : post.cooked
    PrettyText.format_for_email(html, post).html_safe
  end

2 params in both cases


(Felix Freiberger) #10

Hm strange. Let’s just assume that was thrown before the update to beta 2, it hasn’t happened again so far.
Looking closer, it also looks related to a single notification, not digests.

Let’s see what @techAPJ says…


(Jeff Atwood) #11

Let’s just wait and see what happens do not want to send Arpit on wild goose chases.


(Felix Freiberger) #12

Oh wait a second…

Are users supposed to receive a digest in this situation?

  • Nothing happens for a while
  • A topic in a non-watched category is created
  • A topic in a watched category is created soon after

I’d assume that the user receives a digest containing the topic in the non-watched category (or both), but I think what happens is this:

The notification for the watched topic creates a notification, and we update last_emailed_at:

And then the digest mailer sees the user has already been emailed recently:

Is this expected behavior?


Need to confirm that digest mails are being sent
(Jeff Atwood) #13

Seems correct-ish to me. So the real trigger for digest isn’t visits, then, but “have we mailed this user recently for any reason?” What are your thoughts on this @neil?


(Felix Freiberger) #14

Well, it’s both: The condition is the user hasn’t been here for x days (but within the last y days) and hasn’t been emailed for any reason within the last x days.

I really don’t like this, but if you and @neil feel this is correct, I think we should at least edit this copy to reflect this:

image


(Neil Lalonde) #15

If they got an email from the site, then it was probably more targeted to their interests than the summary email would be. They got mentioned, or a topic/category they’re watching has a new post, etc. But if those emails weren’t enough to get them to visit the site, then the summary email might. So I’m open to removing the last_emailed filter. One side effect would be that people using mailing list mode could also get summary emails.


(Felix Freiberger) #16

Watch out: Simply removing that filter will cause digests to be sent out way too often if I’m not mistaken.

Can’t we simply disallow sending digests to users who have mailing list mode enabled? The settings page claims this is already the case:

This setting overrides the activity summary.


(Neil Lalonde) #17

Well now I’m confused. What don’t you like about the current behaviour?


(Felix Freiberger) #18

I don’t like that receiving a normal notification mail delays the next digest.

Don’t get me wrong, I was only trying to point out a technical problem: As far as I see, this filter is the only thing preventing a user from getting a digest every single time the job runs. This means that we cannot simply remove it, but must replace it with a filter checking when the last digest was sent. Or maybe I’m wrong? :slight_smile:


(Neil Lalonde) #19

Yeah we’d need to add a way to track that we sent the digest email already, and add a check for that…

I don’t see a problem with the current approach. “If we haven’t seen you, and we haven’t had any excuse to email you about something you’re directly interested in, try sending a summary of what’s happening on the site.” This is how I follow a few Discourse sites because I’m not very interested in reading every post or subscribing to specific categories, but I don’t want to miss the big announcements and juicy gossip. If I got any other type of email from those sites, I would be surprised and probably visit the site.