Build log

    A walk-in registers while the doctor taps End. Ours could tear the queue.

    An emergency walk-in and the end of a consultation can hit the same queue in the same second. Here is what a review found in our clinic-queue build, what we changed, and what is still not in production.

    GC
    GarunaCDX Editorial
    Editorial team
    Oct 19, 2026 2 min read
    Key takeaways
    • A change that touches several rows should be one transaction.
    • The dangerous case is two legitimate actions at once, not one bad actor.
    • The fix passed local tests. It is not deployed, and we say so.
    • We found this in an audit, not in our test suite, so we test write paths under concurrent load earlier now.

    Quick answer

    In a review of our clinic-queue platform we found that advancing a queue was a series of separate writes. If a walk-in was inserted at the same moment a doctor ended a consultation, the queue could be left half-updated. We moved it into one transaction under a per-doctor lock. It passed 48 assertions and two concurrency runs locally. It is not in production yet.

    The scenario

    A clinic is busy. A patient arrives in an emergency. Reception registers them as a walk-in: they go in right after the consultation in progress, and everyone behind renumbers. In the same second the doctor taps End on that consultation, and the queue advances.

    Two real actions. One queue.

    What the review found

    Advancing the queue was a series of separate writes. When two actions overlap, a series of separate writes can interleave: one action reads the queue, the other changes it, and the first writes over what it read. The queue is left with a gap, a duplicate, or someone in the wrong place.

    What we changed

    We made the queue advance one transaction, under a lock on that one doctor’s queue. Two overlapping actions now run one after the other. Either everything in an action changes or nothing does.

    What we haven’t done

    Status: tested, not deployed

    The change passed 48 assertions and two concurrency runs locally. It is not in production. We do not call it fixed until it is. Nothing has been proven under real clinic load, and no usage number has been measured.

    We found this in an audit, not in our tests. That is the lesson. We now test write paths under concurrent load earlier. The general pattern is explained here, and here is how to test before launch.

    Booking logic review
    Describe your queue or booking flow. We'll point to where overlapping actions can break it.
    Book a review

    The findings and test counts come from our clinic-platform brief and audit notes and are tracked in our claim ledger. No figure comes from a third party.

    Your verdict
    Was this article useful?
    GC
    Written by
    GarunaCDX Editorial
    Editorial team

    Engineers, product and growth folks at GarunaCDX writing about the systems we build for clients.

    View all articles
    Share
    Stay current

    Get GarunaCDX news in your inbox.

    Launches, new case studies and the industry shifts we are watching — once a month.

    Subscribe free
    FAQ

    Frequently asked questions

    Two legitimate actions change the same queue at once: reception inserts an emergency walk-in right after the consultation in progress, and the doctor ends that consultation. If each is a series of separate writes, they can interleave and leave the queue with a gap or a duplicate.

    Make the whole queue advance one transaction, under a lock on that one doctor's queue, so the two actions run one after the other instead of interleaved.

    No. It is tested locally, with 48 assertions and two concurrency runs, and not yet deployed. We call it tested, not fixed.

    The GarunaCDX build log

    Industry insights, once a month

    New case studies, healthcare, marketplace, B2B SaaS and industrial breakdowns, and the engineering notes behind what we ship. One short email a month, no fluff.

    We never share your data — see our Privacy Policy for details.