python event loop consumes one task at a time from C++ notification queue
Summary: Currently, when C++ threads communicate with python's event loop, they place the items on the queue, notify the event loop, and when even loops starts running, they would consume all items from this queue at once. The downside of this approach is that we are unable to deprioritize the upstream tasks to yield to internal python tasks. However, such ability to yield is fundamental to how Thrift approaches load shedding under overload. In this diff we change the approach to take only a single item from the queue at a time. Notice that if queue is not emptied, the consumer will notify the event loop to consume from this queue on the next iteration of the loop. Reviewed By: andriigrynenko Differential Revision: D26163397 fbshipit-source-id: 48cd6cb57c48ea67dce4eb5f0de6db5b0feb75ac
Showing
Please register or sign in to comment