Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cancel All My Appointments!

Cancel All My Appointments!

(Video: https://www.youtube.com/watch?v=VDaKLQE03ss)

The most complicated state in an application is time. Like cooking a bag of microwave popcorn, modern web applications desperately try to keep up with their state through an orchestrated chaos of asynchronous operations popping off in indeterminate cadence. No question, coordinating all this concurrency is hard.

But there's a pitfall at the heart of asynchrony that stays mostly unaddressed.

When an operation doesn't finish right away, synchronously, it's possible the operation may never finish. Or, it may be destined to finish eventually, but a second operation may be raised which means we no longer care about the first. Whatever the case, we need to be able to cancel it. This critical check ultimately protects users from the vagaries of unpredictable systems.

Cancellation should be core to our async programming; no asynchrony should run without it. Too often, such handling is just a corner case exception. Without a cancellation strategy, your applications are incomplete at best.

We'll discuss use-cases for async cancellation and various approaches to managing them.

Kyle Simpson

December 07, 2018

More Decks by Kyle Simpson

Other Decks in Programming


  1. Cancel Abort Call-Off Abandon Stop Kill Revoke Quit Pause? Terminate

    Undo? Final } { Recover
 Rollback Event? State @getify
  2. Events are unexpected. States are expected. Cancellation should never be

    an unexpected exception. Cancellation should be a predictable state. @getify
 USERS . . . . .

  4. If it's async, it's gonna get
 canceled finally { ...whether

    you handle that state or not. cancellation shouldn't be an unexpected exception. @getify
  5. unexpected cancellation states feed uncertainty. } uncertainty spreads unnecessary complexity.

    complexity cancels out software quality and momentum. @getify