Merge pull request #10887 from colinux/manager-emails-parallelize
ETQ super-admin la page qui liste les emails envoyés d'un usager va (peut-être) un plus vite
This commit is contained in:
commit
e39bb4b04d
1 changed files with 10 additions and 7 deletions
|
@ -79,14 +79,17 @@ module Manager
|
|||
email_services = [
|
||||
Sendinblue::API.new,
|
||||
Dolist::API.new
|
||||
]
|
||||
].filter(&:properly_configured?)
|
||||
|
||||
@sent_mails = email_services
|
||||
.filter(&:properly_configured?)
|
||||
.map { |api| api.sent_mails(@user.email) }
|
||||
.flatten
|
||||
.sort_by(&:delivered_at)
|
||||
.reverse
|
||||
@sent_mails = Concurrent::Array.new
|
||||
email_services.map do |api|
|
||||
Thread.new do
|
||||
mails = api.sent_mails(@user.email)
|
||||
@sent_mails.concat(mails)
|
||||
end
|
||||
end.each(&:join)
|
||||
|
||||
@sent_mails.sort_by!(&:delivered_at).reverse!
|
||||
end
|
||||
|
||||
def unblock_email
|
||||
|
|
Loading…
Reference in a new issue