-
-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Event handlers #154
Add Event handlers #154
Conversation
✔️ Deploy Preview for robyn canceled. 🔨 Explore the source changes: cfe74e0 🔍 Inspect the deploy log: https://app.netlify.com/sites/robyn/deploys/61e5e5c5ba9b220008e40d8f |
93790ca
to
5f97e89
Compare
@klaa97 , this PR adds events in Robyn. Could you please have a look at this PR once? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic looks perfect to me! 👏
robyn/__init__.py
Outdated
return | ||
|
||
is_async = asyncio.iscoroutinefunction(handler) | ||
if event_type.lower() == "startup": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor, but for clarity, I would consider to:
- Extract the "startup"/"shutdown" string either in an Enum (like Class(str, Enum) or as constants
- DIrectly use "startup"/"shutdown" as keys for the dictionary
event_handlers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Updated :D
1dd54cf
to
cfe74e0
Compare
Description
This PR fixes #153
TODO: