Pacing, quiet hours and retries
Three guarantees, and where each one actually lives.
Updated
On this page
Three guarantees. Two of them are not in the pacer at all, which is worth knowing before you go looking for them there.
Nobody who opted out is dialled
The pacer doesn't enforce this. The batch does, as a database clause with no argument that switches it off. The pacer's only responsibility is to have no other way of getting a contact. There is no contact query in it, and that absence is the design.
Nobody is rung outside the window
The window is read against the campaign's clock, not the contact's. A contact record holds no timezone, and guessing one from an area code mis-fires on every mobile number somebody kept after moving. The mitigation is that the window is set per campaign rather than per platform, so a list that is all one state gets dialled on that state's clock.
The federal floor is 8am to 9pm in the called party's time zone. The default window here is 9 to 20, deliberately narrower.
A window that wraps past midnight is read as overnight rather than as "never", because a silent never is very hard to diagnose. Setting start and end to the same hour means always.
An unusable timezone string does not stop a campaign. It falls back to UTC and logs an error. Watch for that log line: a campaign silently dialling on UTC is a campaign ringing Texas at three in the morning.
Nobody is rung twice by accident
Every attempt carries a unique key of
campaign:contact:attempt_number. The scheduler tracks nothing about
what it has already run. A tick that overlaps its predecessor writes a
conflicting row and loses on the constraint instead of placing a second
call.
The order matters as much as the key. The attempt row is written first, inside a transaction, and it is what claims the contact. Then the call record. Then the dial. Nothing is dialled that is not already written down.
How much room there is right now
The pacer answers with a number and, when that number is zero, a reason. "Nothing was dialled" and "nothing was dialled because the daily cap is spent" are the same line in a log unless one of them says so, and only the second one means the system is working. The reasons are:
- the campaign is draft, paused or done
- outside the calling window, with the hours and zone spelled out
- billing does not allow traffic, with the billing reason
- n calls already in progress
- the daily cap of n is spent
- nobody is due
That last one is distinguished from the rest on purpose. An empty audience with room to spare is how a campaign finishes, and it is the only signal that says so.
Who is due next
Starting from the batch resolved for calling, four exclusions apply. Each answers a different question.
- Have we already finished with them? An answered call, or one that reached voicemail, ends this campaign's business with that person.
- Are we ringing them right now? A pending attempt means a call is in the air. Without this check, the same contact gets dialled again on the next tick, sixty seconds into a conversation with them.
- Have we tried enough times?
max_attempts, counted from the attempt rows. - Was it too recently?
retry_after_hours, so a no-answer at ten past nine is not retried at eleven past.
What survives is ordered oldest first, then by id. The tiebreak matters. A bulk import gives thousands of contacts the same timestamp, and without a second key the order is whatever the database felt like. Then a campaign paused and resumed reshuffles, and which slice of a list got rung on day one stops being answerable.
Concurrency is counted, not tracked
Calls in the air are counted from attempt rows rather than from a column on the campaign, for the same reason budgets are counted everywhere else. A counter is wrong the first time a process dies between dialling and decrementing, and wrong forever after.
One bad number does not stop a run
A campaign of twenty thousand that stops on the first undialable number is a campaign that never finishes. A dial that raises is logged, and the pass carries on.