mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Increase default SMTP read timeout to 30s (#25763)
A while ago we increased group SMTP read and open timeouts
to address issues we were seeing with Gmail sometimes giving
really long timeouts for these values. The commit was:
3e639e4aa7
Now, we want to increase all SMTP read timeouts to 30s,
since the 5s is too low sometimes, and the ruby Net::SMTP
stdlib also defaults to 30s.
Also, we want to slightly tweak the group smtp email job
not to fail if the IncomingEmail log fails to create, or if
a ReadTimeout is encountered, to avoid retrying the job in sidekiq
again and sending the same email out.
This commit is contained in:
@@ -185,6 +185,18 @@ RSpec.describe Jobs::GroupSmtpEmail do
|
||||
expect(last_email.cc).to match_array(%w[otherguy@test.com cormac@lit.com])
|
||||
end
|
||||
|
||||
it "does not retry the job if the IncomingEmail record is not created because of an error" do
|
||||
Jobs.run_immediately!
|
||||
IncomingEmail.expects(:create!).raises(StandardError)
|
||||
expect { Jobs.enqueue(:group_smtp_email, **args) }.not_to raise_error
|
||||
end
|
||||
|
||||
it "does not retry the job on SMTP read timeouts, because we can't be sure if the send actually failed or if ENTER . ENTER just timed out" do
|
||||
Jobs.run_immediately!
|
||||
Email::Sender.any_instance.expects(:send).raises(Net::ReadTimeout)
|
||||
expect { Jobs.enqueue(:group_smtp_email, **args) }.not_to raise_error
|
||||
end
|
||||
|
||||
context "when there are cc_addresses" do
|
||||
it "has the cc_addresses and cc_user_ids filled in correctly" do
|
||||
job.execute(args)
|
||||
|
||||
Reference in New Issue
Block a user