مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
Change retry and batching timing calculations (#2371)
This patch changes the requeue behaviour to requeue messages that are 30 seconds past their retry time. Batching now includes messages that are any amount past their retry time. This change avoids batching messages before theur graylisting time, but maintains efficient batching.
هذا الالتزام موجود في:
ملتزم من قبل
GitHub
الأصل
c6fb8d223b
التزام
c8d27b2963
@@ -36,10 +36,11 @@ class QueuedMessage < ApplicationRecord
|
||||
after_commit :queue, on: :create
|
||||
|
||||
scope :unlocked, -> { where(locked_at: nil) }
|
||||
scope :retriable, -> { where("retry_after IS NULL OR retry_after <= ?", 30.seconds.from_now) }
|
||||
scope :retriable, -> { where("retry_after IS NULL OR retry_after < ?", Time.now) }
|
||||
scope :requeueable, -> { where("retry_after IS NULL OR retry_after < ?", 30.seconds.ago) }
|
||||
|
||||
def retriable?
|
||||
retry_after.nil? || retry_after <= 30.seconds.from_now
|
||||
retry_after.nil? || retry_after < Time.now
|
||||
end
|
||||
|
||||
def queue
|
||||
@@ -117,7 +118,7 @@ class QueuedMessage < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.requeue_all
|
||||
unlocked.retriable.each(&:queue)
|
||||
unlocked.requeueable.each(&:queue)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم