Skip to content
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

Merged
merged 6 commits into from
Jan 18, 2022
Merged

Add Event handlers #154

merged 6 commits into from
Jan 18, 2022

Conversation

sansyrox
Copy link
Member

@sansyrox sansyrox commented Jan 15, 2022

Description

This PR fixes #153

TODO:

  • Fix freeport dependency

@netlify
Copy link

netlify bot commented Jan 15, 2022

✔️ Deploy Preview for robyn canceled.

🔨 Explore the source changes: cfe74e0

🔍 Inspect the deploy log: https://app.netlify.com/sites/robyn/deploys/61e5e5c5ba9b220008e40d8f

@sansyrox
Copy link
Member Author

@klaa97 , this PR adds events in Robyn. Could you please have a look at this PR once?

Copy link
Contributor

@klaa97 klaa97 left a 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! 👏

return

is_async = asyncio.iscoroutinefunction(handler)
if event_type.lower() == "startup":
Copy link
Contributor

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Updated :D

@sansyrox sansyrox merged commit 5a5bdc9 into main Jan 18, 2022
@sansyrox sansyrox deleted the event_handlers branch January 18, 2022 21:05
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.

Consider adding startup events
2 participants