amelioration(BalancerDeliveryMethod): evite d'envoyer les mails av PJ car pour le moment c'est une fonction payante chez Dolist 🤯
This commit is contained in:
parent
6a25120f80
commit
f952e42ad1
1 changed files with 5 additions and 1 deletions
|
@ -47,8 +47,12 @@ class BalancerDeliveryMethod
|
|||
def delivery_method(mail)
|
||||
return mail[FORCE_DELIVERY_METHOD_HEADER].value.to_sym if force_delivery_method?(mail)
|
||||
|
||||
@delivery_methods
|
||||
compatible_delivery_methods_for(mail)
|
||||
.flat_map { |delivery_method, weight| [delivery_method] * weight }
|
||||
.sample(random: self.class.random)
|
||||
end
|
||||
|
||||
def compatible_delivery_methods_for(mail)
|
||||
@delivery_methods.reject { |delivery_method, _weight| delivery_method.to_s == 'dolist_api' && !Dolist::API.sendable?(mail) }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue