Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Retryer ¶
type Retryer struct {
// contains filtered or unexported fields
}
Retryer defines the service in charge of finding failed deliveries and trying them again.
func New ¶
func New( da action.DeliveryActioner, ma action.MessageActioner, clk clock.Clocker, ) *Retryer
New creates a Retryer instance.
func (*Retryer) DeliverMessage ¶
DeliverMessage queues the message to be delivered.
func (*Retryer) RetrieveFailedMessages ¶
retrieveFailedMessageIDs retrieves from the database all failed messages that were created in the last two hours, then calculates whether each one is due to be retried.
Failed messages are retried on an exponential backoff schedule, waiting 4^i seconds with each retry. Messages that have been tried six times will be considered as permanently failed.
The following table lists the wait time of each retry:
deliveries | wait time | cumul. wait time ------------------------------------------------- 0 | 1s, 1s | 1s 1 | 4s, 4s | 5s 2 | 16s, 16s | 21s 3 | 64s, 1m04s | 1m25 4 | 256s, 4m16s | 5m41 5 | 1024s, 17m04s | 22m45 6 | 4096s, 1h08m16s | 1h31m01
Notes:
- It should not happen for a failed message to have no deliveries. In this case, the message will still be added to the list of messages to deliver.
- The cumulative wait time column is an approximation. The Scheduler service is run periodically, and the exact wait time cannot be calculated beforehand.
Click to show internal directories.
Click to hide internal directories.