Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
crazymidnight authored Jun 2, 2024
1 parent 45d9cf6 commit 07ba597
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/docs/en/getting-started/lifespan/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ search:

# Lifespan Context Manager

Also, you can define *startup* and *shutdown* logic using the `lifespan` parameter of the **FastSTream** app, and a "context manager" (I'll show you what that is in a second).
Also, you can define *startup* and *shutdown* logic using the `lifespan` parameter of the **FastStream** app, and a "context manager" (I'll show you what that is in a second).

Let's start with an example from [hooks page](./hooks.md#another-example){.internal-link} and refactor it using "context manager".

Expand All @@ -21,7 +21,7 @@ We create an async function `lifespan()` with `#!python yield` like this:
As you can see, `lifespan` parameter is much suitable for case (than `#!python @app.on_startup` and `#!python @app.after_shutdown` separated calls) if you have object needs to process at application startup and shutdown both.

!!! tip
`lifespan` starts **BEFORE** your broken started (`#!python @app.on_startup` hook) and **AFTER** broker was shutdown (`#!python @app.after_shutdown`), so you can't publish any messages here.
`lifespan` starts **BEFORE** your broker started (`#!python @app.on_startup` hook) and **AFTER** broker was shutdown (`#!python @app.after_shutdown`), so you can't publish any messages here.

If you want to make some actions will *already/still running broker*, please use `#!python @app.after_startup` and `#!python @app.on_shutdown` hooks.

Expand Down

0 comments on commit 07ba597

Please sign in to comment.