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

feat(processing_engine): Allow async plugin execution. #25994

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

jacksonrnewhouse
Copy link
Contributor

@jacksonrnewhouse jacksonrnewhouse commented Feb 11, 2025

This PR enables scheduled and WAL plugins to run asynchronously, i.e. they will trigger even if a previous instance of the plugin is still running. I've been testing these by just calling sleep(20) from inside of the plugin method.

In confirming that these worked as expected I realized that we were calling blocking PyO3 methods from within our async server methods. This can lead to bad behavior, locking up the tokio worker threads. As such, for both synchronous and asynchronous execution I've switched to using tokio::task::spawn_blocking. This requires moving all of the arguments into the closure, but they are mainly wrapped in Arc's already so not terribly costly.

Currently async execution is specified via --run-asynchronous from the CLI, which adds TriggerFlag::ExecuteAsynchronously to the TriggerDefinition.

@jacksonrnewhouse jacksonrnewhouse force-pushed the processing_engine/async_execution branch from b38a7e4 to 1b49327 Compare February 12, 2025 23:25
@jacksonrnewhouse jacksonrnewhouse force-pushed the processing_engine/async_execution branch from 1b49327 to dc15430 Compare February 12, 2025 23:29
@jacksonrnewhouse jacksonrnewhouse merged commit b0a2422 into main Feb 13, 2025
15 checks passed
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.

2 participants