uranusjr commented on code in PR #68377:
URL: https://github.com/apache/airflow/pull/68377#discussion_r3412193556
##########
task-sdk/src/airflow/sdk/execution_time/comms.py:
##########
Review Comment:
Not sure if I missed anything; the two blocks seem to have mostly the same
logic except the former uses `blocking=False`. I think we can just do
```python
try:
if not self._thread_lock.acquire(blocking=not on_loop_thread):
raise DeadlockImminentError(...)
...
finally:
self._thread_lock.release()
```
or, if this is too difficult to understand, with an inner function
```python
def _communicate():
...
if on_loop_thread:
try:
if not acquire(blocking=False):
raise
_communicate()
finally:
release()
else:
with lock:
_communicate()
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]