Skip to content
Discussion options

You must be logged in to vote

Hi @cheunglok97,

ZEN expressions are optimized for single-threaded use and don't support multi-threading in the evaluation of a single expression. This limitation applies to the ZEN engine as well.

To integrate ZEN decisions within a Tokio-based, multi-threaded environment, you can use Handle::current().block_on to execute these decisions synchronously within an asynchronous context. This approach bypasses Tokio's thread safety requirements for asynchronous functions, allowing you to include non-thread-safe ZEN operations in your Tokio application. For a practical implementation, see this GitHub example.

Let me know if this solves your issue.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@cheunglok97
Comment options

@andymk-dev
Comment options

Answer selected by cheunglok97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants