Skip to content

Discard default lifespans before merging#15424

Open
alfred82santa wants to merge 5 commits into
fastapi:masterfrom
Telefonica:fix/empty-lifespan-contexts
Open

Discard default lifespans before merging#15424
alfred82santa wants to merge 5 commits into
fastapi:masterfrom
Telefonica:fix/empty-lifespan-contexts

Conversation

@alfred82santa

Copy link
Copy Markdown

This pull request improves performance of lifespan contexts. Currently routers inject a default lifespan when no one is provided. The issue is when a router is included to other router, the lifespans (base and child routers' lifespans) must be merged, even when they are no-op default lifespans. This PR checks if base router or child router use a default lifespan to decide if they must be merged.

On the other hand, it changes the way to merge async context manager with a more pythonic way.

@codspeed-hq

codspeed-hq Bot commented Apr 24, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 20 untouched benchmarks


Comparing Telefonica:fix/empty-lifespan-contexts (0d27cd0) with master (1f7c8c1)1

Open in CodSpeed

Footnotes

  1. No successful run was found on master (4f64b8f) during the generation of this report, so 1f7c8c1 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@alfred82santa

Copy link
Copy Markdown
Author

@YuriiMotov can you check it? or do you prefer I close it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant