x42005e1f commented on issue #50185:
URL: https://github.com/apache/airflow/issues/50185#issuecomment-2966998036

   > I'm adding a request ID (integer, atomic auto inc using 
`itertools.counter`) and I was wondering about if we could remove the lock and 
replace it with .... some other primitive from aiologic to send the response 
instead back to async code (possibly a queue? Maybe a flag? Not sure tbh, just 
a thought)
   
   If you only need to wait for a result, currently the most appropriate option 
is to use either a high-level event (`aiologic.Event` if there are many waiters 
of the same result) or a low-level event 
(`aiologic.lowlevel.create_<type>_event()` (>=0.15.0) / 
`aiologic.lowlevel.<Type>Event` (<0.15.0) if there is only one waiter). Just 
set the event after the result is saved somewhere.
   
   If you want to sequentially wait for multiple results, then yes, 
`aiologic.Queue` might be a good option. You may also be interested in 
[`culsans.Queue`](https://github.com/x42005e1f/culsans), which has more 
features.
   
   Flags (`aiologic.Flag` (>=0.15.0) / `aiologic.lowlevel.Flag` (<0.15.0)) have 
a slightly different meaning. They are used in situations where you want to 
know which thread (or state) was first. The analogy from which they get their 
name is related to conquering the mountain / moon / and so on.
   
   I have a plan to add some kind of Future / AsyncResult in the future, but I 
have not decided on the interface yet.


-- 
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

Reply via email to