---
url: https://scruple.dev/rules/async/require-race-loser-cleanup.md
description: Require cleanup of locally owned race losers.
---

# async/require-race-loser-cleanup

Require cleanup of locally owned race losers.

## What it checks

Locally created branches that lose Promise.race or Promise.any need cancellation, settlement observation, or cleanup.

## Rule metadata

* Package: `@scruple/async`
* Category: Concurrency
* Tags: Promise.race, cancellation, cleanup
* Default threshold: `plugin default`
* Minimum confidence: `plugin default`

## Examples

### Reported

```ts
await Promise.race([fetch(url), delay(1000)]);
```

### Accepted

```ts
await fetch(url, { signal: AbortSignal.timeout(1000) });
```
