Skip to content

Part 4 of 7 · Shift swap broker series ~5 min read

How the offer loop works

There are two obvious ways to run an offer loop and both are wrong. Sending to everybody at once produces a race that the person with notifications on always wins. Sending to one person at a time is fair and takes three days. This post is about the middle.

Key takeaways

  • Batches of two or three, in list order, with a time limit per batch.
  • The time limit shrinks as the shift gets closer, from hours to minutes.
  • First to accept wins within a batch, and a conditional write makes that safe.
  • Nobody is told they were in a later batch, or that somebody declined.
  • When the list runs out, the manager is told with the reason each person was excluded.

Batches with a clock

How a shift offer is sent out in batches with a time limitA vertical chain of five steps entered by a box labelled An ordered list of three to six people. Step one offers to the first batch of two or three, with a time limit derived from how many days remain until the shift. Step two asks whether anyone accepted, decided by a conditional write; an acceptance exits to Taken, which quietly closes the other offers. Step three asks whether the limit expired with more people left, exiting to Next batch at the same size with a shorter clock. Step four is List exhausted, with nobody eligible left. Step five tells the manager, including why each person was excluded. A note says the last step is the useful one, because nobody available is not an answer a manager can use.AWS ACCOUNTAn ordered listthree to six peopleOffer to the first batchtwo or threeTime limitfrom days-to-shiftAnyone accepted?conditional writeTakenclose the others quietlyyesLimit expired?and more people leftNext batchsame size, shorter clockyesList exhaustednobody eligible leftTell the managerwith why each was excludedThe last step is the useful one. 'Nobody available' is not an answer a manager can use.
Fig 1. The offer loop. The exhausted path is the one that earns its place: a manager needs to know why nobody was eligible, not merely that nobody was.
  • App integration
  • Machine learning
  • Management
  • Analytics
  • Front-end & mobile
  • People

Why two or three

One at a time is fairest and far too slow: three people with a four-hour window each is half a day before the fourth is even asked. Everybody at once is instant and gives every shift to whoever happens to be looking at their phone, which over a year is a real and unfair distribution of money.

Two or three at a time keeps the loop moving while preserving most of the ordering’s effect. The people at the top of the list still get first refusal; they just get it alongside one or two others rather than alone.

The shrinking clock

Days to the shiftWindow per batchWhy
7 or more8 hoursNo urgency; let people see it when they wake up
3 to 64 hoursStill comfortable, but the loop needs to finish
290 minutesTwo batches will fit into a day
130 minutesEffectively the last chance before it becomes the manager’s

A fixed window fails at both ends: eight hours per batch a day before the shift means the loop is still running when the shift starts, and thirty minutes a week out is needlessly aggressive about a Thursday that is seven days away.

Winning a race safely

Two people in the same batch can accept within the same second, and exactly one has to win. That is a conditional write on the offer’s state: the first accept sets it from open to taken, and the second finds it already taken and is shown that plainly rather than being told it succeeded.

The message the loser sees matters: “Rae got there first” is honest and fine. “You were not selected” is not what happened and reads badly. It is one sentence and it is the difference between a system people use and one they resent.

When nobody takes it

The breakdown a manager receives when nobody takes a shiftA horizontal row of five boxes. Eleven at the site: the starting set. Four already on: not free. Two untrained: on that station. Two into overtime: would cross forty hours. Three asked, none took: so it is now the manager's. A note says a manager can act on this, whereas no cover found gives them nothing to work with.WHY NOBODY COVERED11 at the sitethe starting set4 already onnot free2 untrainedon that station2 into overtimewould cross 40h3 asked, none tookmanager's nowA manager can act on this. 'No cover found' gives them nothing to work with.
Fig 2. What the manager is told when a swap fails. The breakdown is the difference between a dead end and a decision: two of those four numbers are things a manager can override.

That breakdown is genuinely actionable. Two people excluded for overtime is a decision a manager can take — approve the overtime, or not. Two untrained on the station is a training gap that this exact situation will produce again next month. “No cover found” contains none of that.

Next: what approval actually does.

All posts