---
title: "Handling concurrency on the Web with Web Locks API"
description: "OLX uses the browser's Web Locks API to stop multiple open tabs from each resuming the same large (up to 20GB) S3 upload after a restart. localStorage-plus-polling suffers from non-atomic writes and stale locks, and BroadcastChannel forces you to hand-roll a coordination protocol, whereas navigator.locks offers an atomic mutex that is released automatically when a tab closes or crashes."
url: "https://swe.quest/articles/handling-concurrency-on-the-web-with-web-locks-api-77f6e6e155c9a3e0"
canonical: "https://tech.olx.com/handling-concurrency-on-the-web-with-web-locks-api-163b7e07eddd"
source: "OLX Tech"
published: "2026-07-14"
difficulty: "medium"
kind: "Case study"
reading_minutes: 6
tags: ["browsers","concurrency","frontend","react"]
---

# Handling concurrency on the Web with Web Locks API

A post on [OLX Tech](https://swe.quest/sources/olx.md), published 2026-07-14, 6 min read, Case study. Original: [https://tech.olx.com/handling-concurrency-on-the-web-with-web-locks-api-163b7e07eddd](https://tech.olx.com/handling-concurrency-on-the-web-with-web-locks-api-163b7e07eddd)

## Summary

OLX uses the browser's Web Locks API to stop multiple open tabs from each resuming the same large (up to 20GB) S3 upload after a restart. localStorage-plus-polling suffers from non-atomic writes and stale locks, and BroadcastChannel forces you to hand-roll a coordination protocol, whereas navigator.locks offers an atomic mutex that is released automatically when a tab closes or crashes. A React hook requests the lock with ifAvailable: fresh user-initiated uploads proceed whether or not they get it, restored uploads run only in the tab holding it, and the lock is held until a complete, error, cancel or unmount event. Where the API is unavailable, the hook falls back to allowing restores and accepts the risk of duplicates, and the team reports zero cross-tab duplicate uploads since rollout.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Browsers](https://swe.quest/tags/browsers.md) (Web & mobile)
- [Concurrency](https://swe.quest/tags/concurrency.md) (Compilers & runtimes)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [React](https://swe.quest/tags/react.md) (Web & mobile)

## Prerequisites

- JavaScript Promises ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))
- React hooks ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- Mutex/lock basics

## Keywords

Web Locks API, BroadcastChannel, localStorage, React, Amazon S3

## Related posts

- [Session revocations at scale](https://swe.quest/articles/session-revocations-at-scale-0e845eb64b268c30.md): Canva Engineering · 2026-07-22 · Medium · 9 min read · Identity & auth, Caching, Scaling, System design, Storage systems
  Canva moved its gateway session-revocation cache from per-pod MySQL loads to sorted binary chunks in S3, eliminating the database stampede when hundreds of gateway pods started during deploys.
- [Improved Process Isolation in Firefox 100](https://swe.quest/articles/improved-process-isolation-in-firefox-100-c5bc38aed6bfa0ee.md): Mozilla Hacks · 2022-05-12 · Hard · 9 min read · Sandboxing & isolation, Browsers, Security, Operating systems
  Firefox 100 enables Win32k Lockdown on Windows, using PROCESS\_MITIGATION\_SYSTEM\_CALL\_DISABLE\_POLICY to block web content processes from calling the historically exploitable win32k.sys kernel APIs.
- [Tab Unloading in Firefox 93](https://swe.quest/articles/tab-unloading-in-firefox-93-01f43dc391aafc23.md): Mozilla Hacks · 2021-10-05 · Medium · 6 min read · Browsers, Memory management, Resilience
  Firefox 93 on Windows unloads memory-heavy background tabs in least-recently-used order when system memory is critically low, keeping them in the tab bar and restoring scroll position and form data on reselect.
- [Supabase Storage v3: Resumable Uploads with support for 50GB files](https://swe.quest/articles/supabase-storage-v3-resumable-uploads-with-support-for-50gb-files-bff6f0225c2de6f0.md): Supabase · 2023-04-12 · Medium · 7 min read · Storage systems, PostgreSQL, Concurrency, API design
  Supabase Storage v3 adds resumable uploads via the open TUS protocol, raising the max file size to 50GB on Pro plans.
- [Learnings from migrating Accessibility Insights for Web to Chrome’s Manifest V3](https://swe.quest/articles/learnings-from-migrating-accessibility-insights-for-web-to-chrome-s-manifest-v3-59376d341bf90ff8.md): Engineering@Microsoft · 2022-12-15 · Medium · 6 min read · Browsers, JavaScript, Refactoring & migrations, Accessibility
  Moving the Accessibility Insights for Web extension from Manifest V2 to V3 meant replacing persistent background pages with service workers that can shut down when idle.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
