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

NEW: support of async hooks #70

Merged
merged 1 commit into from
Jul 10, 2024
Merged

Conversation

ss18
Copy link
Member

@ss18 ss18 commented Jul 9, 2024

Motivation
The current implementation of the py-timeexecution library lacks support for asynchronous hooks, which limits its applicability in modern asynchronous Python applications.

Implementation
Added TimedAsync which is async ContextManager. It can await hook if hook is an actual coroutine function.

@eigenein eigenein self-requested a review July 9, 2024 19:17
@ss18 ss18 force-pushed the feature/DEP-2912-async-hooks branch 2 times, most recently from 4703c24 to a7179ca Compare July 9, 2024 20:49
@ss18 ss18 changed the title WIP: support of async hooks (#DEP-2912) NEW: support of async hooks (#DEP-2912) Jul 9, 2024
@ss18 ss18 force-pushed the feature/DEP-2912-async-hooks branch 4 times, most recently from 913e571 to 63f3347 Compare July 10, 2024 09:35
@ss18 ss18 changed the title NEW: support of async hooks (#DEP-2912) NEW: support of async hooks Jul 10, 2024
@ss18 ss18 force-pushed the feature/DEP-2912-async-hooks branch 3 times, most recently from 1e5fef1 to 0aec83b Compare July 10, 2024 12:14
assert metadata["async_global_hook"] == "async_global_hook value"
collector.clean()

assert True
Copy link
Member

Choose a reason for hiding this comment

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

Leftover?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, well spotted!
Fixed.

eigenein
eigenein previously approved these changes Jul 10, 2024
@ss18 ss18 force-pushed the feature/DEP-2912-async-hooks branch from 0aec83b to cd3c8d1 Compare July 10, 2024 16:39
@ss18 ss18 merged commit a204ccc into kpn:master Jul 10, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants