Problem
DoorDash sends a push reminder when a user adds items to a cart and does not check out. The hard part is knowing whether the user abandoned the cart or is still browsing for more items or other merchants. The first design polled the backend cart service at a fixed interval and sent a reminder if the cart had not changed. It ignored what the user was doing, so it could send unneeded notifications.
Illustrative example: a user adds a dish to the cart, keeps looking at other restaurants, and gets a "complete your order" push in the middle of browsing.
Solution in brief
Use the end of a session as the trigger. A streaming job groups frontend events per user into sessions and emits a signal after the user has been inactive for the session gap. The notification service checks eligibility and sends the push.
Questions this case answers
- How to detect the end of a user's activity in real time from a stream of client events so that a message is sent only after the user has truly stopped
- How to tell that a user has really abandoned a cart rather than still browsing, before sending a reminder push?
- How to detect the end of a user session in real time from frontend events?
- How to trigger a notification on user inactivity without polling backend services?
Tools and methods
- Real-time sessionization — group a user's mobile and web events into sessions and detect inactivity as the session end.
- Apache Flink — stateful stream job; in-flight session events are kept as state in the RocksDB backend, checkpoints go to S3.
- Apache Kafka — carries raw events into the job and session signals out to the application.
- Eligibility checks — drop sends for closed carts, missing fields and other cases where a push would be useless.
Google or a one-time email code. No password.