Skip to content

Commit 66b597a

Browse files
committed
Clarify waitUntil best practice guidance
1 parent c4d854a commit 66b597a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/content/docs/workers/best-practices/workers-best-practices.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ For more information, refer to [Workers errors](/workers/observability/errors/#c
749749

750750
A `Promise` that is not `await`ed, `return`ed, or passed to `ctx.waitUntil()` is a floating promise. Floating promises cause silent bugs: dropped results, swallowed errors, and unfinished work. The Workers runtime may terminate your isolate before a floating promise completes.
751751

752-
Choose based on whether the work is required. Use `await` or `return` for work that must complete before the response is correct. Use `ctx.waitUntil()` for best-effort work that may run after the response is sent and can finish within the `waitUntil()` time limit. For work that must complete reliably after the response, use [Queues](/queues/) or [Workflows](/workflows/).
752+
Choose based on whether the response depends on the work. Use `await` or `return` for work that must complete before the response is correct. Use `ctx.waitUntil()` for work that can run after the response is sent and can finish within the `waitUntil()` time limit.
753753

754754
Enable the `no-floating-promises` lint rule to catch these at development time. If you use ESLint, enable [`@typescript-eslint/no-floating-promises`](https://typescript-eslint.io/rules/no-floating-promises/). If you use oxlint, enable [`typescript/no-floating-promises`](https://oxc.rs/docs/guide/usage/linter/rules/typescript/no-floating-promises.html).
755755

0 commit comments

Comments
 (0)