<mxfile host="thecodeclouds.com" agent="hand-built" version="24.0.0" type="device">
<diagram id="inventory" name="4. Inventory reservation without oversell"><mxGraphModel dx="1400" dy="900" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1500" pageHeight="900" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="c1" value="Scenario: one unit left, two shoppers press Pay 40 ms apart" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=18;fontColor=#232F3E;fontStyle=1;spacing=0;" vertex="1" parent="1"><mxGeometry x="20" y="16" width="1300" height="24" as="geometry"/></mxCell>
<mxCell id="c2" value="Read-then-write lets both win. One conditional UPDATE lets exactly one win, and a reservation with an expiry gives the stock back if checkout dies." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="20" y="44" width="1400" height="18" as="geometry"/></mxCell>
<mxCell id="c3" value="&lt;b&gt;Wrong: read, check in code, then write&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#D93025;fillColor=#FFFBFA;dashed=0;fontSize=12;fontStyle=0;fontColor=#D93025;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="20" y="80" width="700" height="440" as="geometry"/></mxCell>
<mxCell id="a" value="&lt;b&gt;Shopper A&lt;/b&gt;" style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#5F6368;fillColor=#F1F3F4;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="60" y="115" width="160" height="46" as="geometry"/></mxCell>
<mxCell id="c4" style="edgeStyle=none;html=1;rounded=0;strokeColor=#BDC1C6;strokeWidth=1.5;dashed=1;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="140" y="161" as="sourcePoint"/><mxPoint x="140" y="445" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="row" value="&lt;b&gt;stock row sku-123&lt;/b&gt;" style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#1E8E3E;fillColor=#E6F4EA;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="290" y="115" width="160" height="46" as="geometry"/></mxCell>
<mxCell id="c5" style="edgeStyle=none;html=1;rounded=0;strokeColor=#BDC1C6;strokeWidth=1.5;dashed=1;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="370" y="161" as="sourcePoint"/><mxPoint x="370" y="445" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="b" value="&lt;b&gt;Shopper B&lt;/b&gt;" style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#5F6368;fillColor=#F1F3F4;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="520" y="115" width="160" height="46" as="geometry"/></mxCell>
<mxCell id="c6" style="edgeStyle=none;html=1;rounded=0;strokeColor=#BDC1C6;strokeWidth=1.5;dashed=1;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="600" y="161" as="sourcePoint"/><mxPoint x="600" y="445" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c7" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1A73E8;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="140" y="200" as="sourcePoint"/><mxPoint x="370" y="200" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c8" value="SELECT available → 1" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#1A73E8;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="146" y="174" width="218" height="17" as="geometry"/></mxCell>
<mxCell id="c9" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1A73E8;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="600" y="245" as="sourcePoint"/><mxPoint x="370" y="245" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c10" value="SELECT available → 1" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#1A73E8;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="376" y="219" width="218" height="17" as="geometry"/></mxCell>
<mxCell id="c11" style="edgeStyle=none;html=1;rounded=0;strokeColor=#D93025;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="140" y="300" as="sourcePoint"/><mxPoint x="370" y="300" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c12" value="UPDATE available = 0" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#D93025;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="146" y="274" width="218" height="17" as="geometry"/></mxCell>
<mxCell id="c13" style="edgeStyle=none;html=1;rounded=0;strokeColor=#D93025;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="600" y="345" as="sourcePoint"/><mxPoint x="370" y="345" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c14" value="UPDATE available = 0" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#D93025;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="376" y="319" width="218" height="17" as="geometry"/></mxCell>
<mxCell id="c15" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1E8E3E;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="370" y="400" as="sourcePoint"/><mxPoint x="140" y="400" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c16" value="order placed" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#1E8E3E;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="146" y="374" width="218" height="17" as="geometry"/></mxCell>
<mxCell id="c17" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1E8E3E;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="370" y="400" as="sourcePoint"/><mxPoint x="600" y="400" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c18" value="order placed" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#1E8E3E;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="376" y="374" width="218" height="17" as="geometry"/></mxCell>
<mxCell id="bad" value='&lt;b&gt;2 orders, 1 unit. Someone gets a "sorry" email.&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;Raising the isolation level to SERIALIZABLE fixes it&lt;/font&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;but aborts and retries under load.&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#D93025;fillColor=#FCE8E6;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="70" y="455" width="600" height="56" as="geometry"/></mxCell>
<mxCell id="c19" value="&lt;b&gt;Right: let the database do the check, atomically&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#1E8E3E;fillColor=#FAFFFB;dashed=0;fontSize=12;fontStyle=0;fontColor=#1E8E3E;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="780" y="80" width="700" height="440" as="geometry"/></mxCell>
<mxCell id="a2" value="&lt;b&gt;Shopper A&lt;/b&gt;" style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#5F6368;fillColor=#F1F3F4;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="820" y="115" width="160" height="46" as="geometry"/></mxCell>
<mxCell id="c20" style="edgeStyle=none;html=1;rounded=0;strokeColor=#BDC1C6;strokeWidth=1.5;dashed=1;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="900" y="161" as="sourcePoint"/><mxPoint x="900" y="365" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="row2" value="&lt;b&gt;stock row sku-123&lt;/b&gt;" style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#1E8E3E;fillColor=#E6F4EA;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="1050" y="115" width="160" height="46" as="geometry"/></mxCell>
<mxCell id="c21" style="edgeStyle=none;html=1;rounded=0;strokeColor=#BDC1C6;strokeWidth=1.5;dashed=1;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1130" y="161" as="sourcePoint"/><mxPoint x="1130" y="365" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="b2" value="&lt;b&gt;Shopper B&lt;/b&gt;" style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#5F6368;fillColor=#F1F3F4;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="1280" y="115" width="160" height="46" as="geometry"/></mxCell>
<mxCell id="c22" style="edgeStyle=none;html=1;rounded=0;strokeColor=#BDC1C6;strokeWidth=1.5;dashed=1;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1360" y="161" as="sourcePoint"/><mxPoint x="1360" y="365" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c23" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1E8E3E;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="900" y="200" as="sourcePoint"/><mxPoint x="1130" y="200" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c24" value="UPDATE … WHERE on_hand - reserved &amp;gt;= 1" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#1E8E3E;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="906" y="174" width="218" height="17" as="geometry"/></mxCell>
<mxCell id="c25" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1E8E3E;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1130" y="245" as="sourcePoint"/><mxPoint x="900" y="245" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c26" value="1 row: reserved" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#1E8E3E;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="906" y="219" width="218" height="17" as="geometry"/></mxCell>
<mxCell id="c27" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1A73E8;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1360" y="300" as="sourcePoint"/><mxPoint x="1130" y="300" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c28" value="same UPDATE (waits on row lock)" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#1A73E8;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="1136" y="274" width="218" height="17" as="geometry"/></mxCell>
<mxCell id="c29" style="edgeStyle=none;html=1;rounded=0;strokeColor=#E8710A;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="1130" y="345" as="sourcePoint"/><mxPoint x="1360" y="345" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c30" value="0 rows: sold out" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#E8710A;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="1136" y="319" width="218" height="17" as="geometry"/></mxCell>
<mxCell id="c31" value="&lt;b&gt;&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#1E8E3E;fillColor=#FFFFFF;dashed=0;fontSize=12;fontStyle=0;fontColor=#3C4043;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="800" y="380" width="660" height="132" as="geometry"/></mxCell>
<mxCell id="c32" value="BEGIN;" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="812" y="386" width="640" height="17" as="geometry"/></mxCell>
<mxCell id="c33" value="UPDATE stock SET reserved = reserved + :qty" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="812" y="403" width="640" height="17" as="geometry"/></mxCell>
<mxCell id="c34" value=" WHERE sku = :sku AND on_hand - reserved &amp;gt;= :qty;" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="812" y="420" width="640" height="17" as="geometry"/></mxCell>
<mxCell id="c35" value="-- 0 rows? ROLLBACK, tell the shopper it sold out" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="812" y="437" width="640" height="17" as="geometry"/></mxCell>
<mxCell id="c36" value="INSERT INTO reservations (id, sku, qty, checkout_id, expires_at)" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="812" y="454" width="640" height="17" as="geometry"/></mxCell>
<mxCell id="c37" value=" VALUES (:id, :sku, :qty, :ck, now() + interval '15 min');" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="812" y="471" width="640" height="17" as="geometry"/></mxCell>
<mxCell id="c38" value="COMMIT;" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#202124;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="812" y="488" width="640" height="17" as="geometry"/></mxCell>
<mxCell id="c39" value="&lt;b&gt;Reservation lifecycle&lt;/b&gt;" style="rounded=1;arcSize=8;html=1;whiteSpace=wrap;strokeColor=#1A73E8;fillColor=#FFFFFF;dashed=0;fontSize=12;fontStyle=0;fontColor=#1A73E8;align=left;verticalAlign=top;spacingLeft=8;" vertex="1" parent="1"><mxGeometry x="20" y="550" width="1460" height="320" as="geometry"/></mxCell>
<mxCell id="av" value='&lt;b&gt;Available&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;on_hand - reserved&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#5F6368;fillColor=#F1F3F4;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="50" y="650" width="170" height="60" as="geometry"/></mxCell>
<mxCell id="held" value='&lt;b&gt;HELD&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;expires_at = now() + 15 min&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#E8710A;fillColor=#FEF1E3;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="330" y="650" width="220" height="60" as="geometry"/></mxCell>
<mxCell id="com" value='&lt;b&gt;COMMITTED&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;on_hand -= qty, reserved -= qty&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#1E8E3E;fillColor=#E6F4EA;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="700" y="600" width="260" height="60" as="geometry"/></mxCell>
<mxCell id="ship" value='&lt;b&gt;SHIPPED&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;pick, pack, capture payment&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#1A73E8;fillColor=#E8F0FE;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="1080" y="600" width="240" height="60" as="geometry"/></mxCell>
<mxCell id="rel" value='&lt;b&gt;RELEASED&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;reserved -= qty&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#D93025;fillColor=#FCE8E6;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="700" y="700" width="260" height="56" as="geometry"/></mxCell>
<mxCell id="exp" value='&lt;b&gt;EXPIRED&lt;/b&gt;&lt;br&gt;&lt;font style="font-size:10px" color="#5F6368"&gt;reserved -= qty&lt;/font&gt;' style="rounded=1;arcSize=10;html=1;whiteSpace=wrap;strokeColor=#D93025;fillColor=#FCE8E6;strokeWidth=1.5;dashed=0;fontSize=12;fontColor=#202124;align=center;verticalAlign=middle;" vertex="1" parent="1"><mxGeometry x="700" y="790" width="260" height="56" as="geometry"/></mxCell>
<mxCell id="c40" style="edgeStyle=none;html=1;rounded=0;strokeColor=#E8710A;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="av" target="held"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell>
<mxCell id="c41" value="reserve (step 2)" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#E8710A;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="225" y="655" width="100" height="17" as="geometry"/></mxCell>
<mxCell id="c42" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1E8E3E;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=1;exitY=0.3;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="held" target="com"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell>
<mxCell id="c43" value="order confirmed (step 5)" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#1E8E3E;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="545" y="585" width="140" height="17" as="geometry"/></mxCell>
<mxCell id="c44" style="edgeStyle=none;html=1;rounded=0;strokeColor=#1A73E8;strokeWidth=2;dashed=0;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="com" target="ship"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell>
<mxCell id="c45" style="edgeStyle=none;html=1;rounded=0;strokeColor=#D93025;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=1;exitY=0.7;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="held" target="rel"><mxGeometry relative="1" as="geometry"></mxGeometry></mxCell>
<mxCell id="c46" value="payment failed (C2)" style="text;html=1;whiteSpace=wrap;align=center;verticalAlign=top;fontSize=11;fontColor=#D93025;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="565" y="705" width="130" height="17" as="geometry"/></mxCell>
<mxCell id="c47" style="edgeStyle=none;html=1;rounded=0;strokeColor=#D93025;strokeWidth=2;dashed=1;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="held" target="exp"><mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="440" y="818"/></Array></mxGeometry></mxCell>
<mxCell id="c48" value="sweeper, every minute:&lt;br&gt;expires_at &amp;lt; now() AND status = HELD" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#D93025;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="345" y="760" width="250" height="32" as="geometry"/></mxCell>
<mxCell id="c49" style="edgeStyle=none;html=1;rounded=0;strokeColor=#5F6368;strokeWidth=1.5;dashed=1;startArrow=none;startFill=1;endArrow=block;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="960" y="728" as="sourcePoint"/><mxPoint x="100" y="710" as="targetPoint"/><Array as="points"><mxPoint x="1000" y="728"/><mxPoint x="1000" y="855"/><mxPoint x="100" y="855"/></Array></mxGeometry></mxCell>
<mxCell id="c50" style="edgeStyle=none;html=1;rounded=0;strokeColor=#5F6368;strokeWidth=1.5;dashed=1;startArrow=none;startFill=1;endArrow=none;endFill=1;endSize=4;startSize=4;" edge="1" parent="1"><mxGeometry relative="1" as="geometry"><mxPoint x="960" y="818" as="sourcePoint"/><mxPoint x="1000" y="818" as="targetPoint"/></mxGeometry></mxCell>
<mxCell id="c51" value="stock returns to the pool" style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=11;fontColor=#5F6368;fontStyle=0;spacing=0;labelBackgroundColor=#FFFFFF;" vertex="1" parent="1"><mxGeometry x="1010" y="770" width="160" height="17" as="geometry"/></mxCell>
<mxCell id="c52" value="Release and expiry both use&lt;br&gt;WHERE status = 'HELD', so&lt;br&gt;they can race safely: only one&lt;br&gt;of them changes the row." style="text;html=1;whiteSpace=wrap;align=left;verticalAlign=top;fontSize=12;fontColor=#202124;fontStyle=0;spacing=0;" vertex="1" parent="1"><mxGeometry x="1210" y="690" width="260" height="66" as="geometry"/></mxCell></root></mxGraphModel></diagram>
</mxfile>
