abhiTronix / vidgear

A High-performance cross-platform Video Processing Python framework powerpacked with unique trailblazing features :fire:
https://abhitronix.github.io/vidgear
Apache License 2.0
3.33k stars 253 forks source link

[Proposal]: Deprecate `on_startup` and `on_shutdown` in favor of `lifespan` #397

Closed abhiTronix closed 3 months ago

abhiTronix commented 4 months ago

Issue guidelines

Issue Checklist

Describe your Idea

Currently, Starlette supports on_startup and on_shutdown hooks for running startup and shutdown tasks. However, these hooks have certain limitations and are not as robust as the lifespan approach, which uses async context managers.

Use Cases

The lifespan approach provides a more structured and reliable way to handle startup and shutdown tasks, and it is recommended by the ASGI specification (https://asgi.readthedocs.io/en/latest/specs/lifespan.html). This proposal aligns with the ASGI specification and promotes best practices for handling startup and shutdown tasks in Starlette applications in our APIs such as WebGear and WebGear_RTC which uses it.

Any other Relevant Information?

Related Issues:

abhiTronix commented 3 months ago

Successfully fixed in commit https://github.com/abhiTronix/vidgear/commit/20dec0accda1ca9a850d91bcec194184176f1b70