https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292020-10-26T11:58:15ZRedmineRedmine - Defect #33881: No email notifications for status changes triggered by fixing keywords in repository commits.https://www.redmine.org/issues/33881?journal_id=995552020-10-26T11:58:15ZTobias Grimm
<ul></ul><p>Same here. I digged a little bit deeper:</p>
<p>When I manually trigger fetching the git commits by going to the repositories page, then email sending of status changes triggered by a commit works fine. If the commits are fetched by the redmine:fetch_changesets (via cron), then no email notifications are sent.</p>
<p>Looking at the log I see, that in both cases an ActionMailer::DeliveryJob is enqueued. I also see "Performing ActionMailer::DeliveryJob" in both cases, but only in the first case I see "Rendering mailer/issue_edit.text.erb within layouts/mailer" actually happening.</p>
<p>This seems to be related to the async ActiveJob, which causes the queued delivery jobs to not be executed before the fetch_changesets process ends.</p>
<p>My lazy solution for this was to add a sleep(10) in the fetch_changesets rake task to give the async delivery some time before the rake process ends.</p>
<p>This might already be fixed in a later Redmine/Rails version. I'm running the Debian-packed version from buster-baclports.</p>
<p>Environment:<br /> Redmine version 4.0.7.stable<br /> Ruby version 2.5.5-p157 (2019-03-15) [x86_64-linux-gnu]<br /> Rails version 5.2.3<br /> Environment production<br /> Database adapter Mysql2<br /> Mailer queue ActiveJob::QueueAdapters::AsyncAdapter<br /> Mailer delivery sendmail<br />SCM:<br /> Git 2.20.1<br /> Filesystem <br />Redmine plugins:<br /> no plugin installed</p> Redmine - Defect #33881: No email notifications for status changes triggered by fixing keywords in repository commits.https://www.redmine.org/issues/33881?journal_id=1035092021-08-02T16:47:28ZAndrew Skripnikov
<ul></ul><p>Hi, Tobias!</p>
<p>Could you please give me more details what I need to edit to fix this issue.</p>
<p>Seems, it is not fixed in Redmine 4.2.1.stable</p>
<p>Thank you in advance</p>
<p>Looking forward for your reply</p> Redmine - Defect #33881: No email notifications for status changes triggered by fixing keywords in repository commits.https://www.redmine.org/issues/33881?journal_id=1035322021-08-03T10:11:35ZTobias Grimm
<ul></ul><p>In redmine.rake (<a class="external" href="https://www.redmine.org/projects/redmine/repository/entry/trunk/lib/tasks/redmine.rake">https://www.redmine.org/projects/redmine/repository/entry/trunk/lib/tasks/redmine.rake</a>) in the :fetch_changesets-Task add a sleep after fetching the changesets:</p>
<pre>
task :fetch_changesets => :environment do
Repository.fetch_changesets
sleep(5)
end
</pre>
<p>This will give redmine the time to actually deliver the emails before the process ends.</p> Redmine - Defect #33881: No email notifications for status changes triggered by fixing keywords in repository commits.https://www.redmine.org/issues/33881?journal_id=1035622021-08-05T15:50:20ZAndrew Skripnikov
<ul></ul><p>Thank you very much!<br />This hales a lot :)</p> Redmine - Defect #33881: No email notifications for status changes triggered by fixing keywords in repository commits.https://www.redmine.org/issues/33881?journal_id=1035912021-08-06T21:54:04ZMischa The Evil
<ul></ul><p>FYI, I think you're all using an in-memory queue which might be the issue here.</p>
<p>From <a class="source" href="https://www.redmine.org/projects/redmine/repository/svn/entry/tags/4.0.7/app/models/mailer.rb#L604">source:/tags/4.0.7/app/models/mailer.rb#L604</a> and <a class="source" href="https://www.redmine.org/projects/redmine/repository/svn/entry/tags/4.1.1/app/models/mailer.rb#L620">source:/tags/4.1.1/app/models/mailer.rb#L620</a>:</p>
<blockquote>
<pre><code class="ruby syntaxhl"> <span class="c1"># Using the asynchronous queue from a Rake task will generally not work because</span>
<span class="c1"># Rake will likely end, causing the in-process thread pool to be deleted, before</span>
<span class="c1"># any/all of the .deliver_later emails are processed</span>
</code></pre>
</blockquote>
<p>FWIW: Jean-Philippe Lang wrote in <a class="news" href="https://www.redmine.org/news/119">Redmine 4.0.0, 3.4.7 and 3.3.9 released</a>:</p>
<blockquote>
<p>Email delivery now relies on Rails ActiveJob. Emails are sent asynchronously by default. But you should consider configuring a persistent backend for ActiveJob since the default uses an in-memory queue that is not well suited for production environnements:<br /><a class="external" href="https://guides.rubyonrails.org/v5.2/active_job_basics.html#job-execution">https://guides.rubyonrails.org/v5.2/active_job_basics.html#job-execution</a></p>
</blockquote>