Cleaned up deliverytime calculation logic
This commit is contained in:
parent
d83d7ef621
commit
82b1887bfe
@ -380,7 +380,8 @@ class BatchSendingService {
|
||||
// Calculate the target delivery time for the batch
|
||||
const timeRemaining = deadline.getTime() - lastDeliveryTime.getTime();
|
||||
const targetDeliveryDelay = Math.abs(timeRemaining / (queue.length + 1));
|
||||
const targetDeliveryTime = new Date(Math.min(lastDeliveryTime.getTime() + targetDeliveryDelay, deadline.getTime()));
|
||||
const calculatedDeliveryTime = lastDeliveryTime.getTime() + targetDeliveryDelay;
|
||||
const targetDeliveryTime = new Date(Math.min(calculatedDeliveryTime, deadline.getTime()));
|
||||
batchData.deliveryTime = targetDeliveryTime;
|
||||
lastDeliveryTime = targetDeliveryTime;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user