x42005e1f commented on issue #50185: URL: https://github.com/apache/airflow/issues/50185#issuecomment-2967405096
> > the synchronous code will not be able to interrupt its execution to resume execution of asynchronous code. It will only work if they are different threads. > > And we don't get that via `sync_to_async` as all calls to that use a single Thread? `sync_to_async()` delegates execution to a worker thread. This eliminates the requirement to switch from synchronous to asynchronous code (since asynchronous code just waits for a future object), which in turn bypasses the problem - you can even synchronize in synchronous code, as long as synchronous code does not depend on asynchronous code in the same thread. Of course, this is true only when `sync_to_async()` is used for full operations - if it is used for single reads that are part of the whole `get_message()`, the problem remains. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org