简体   繁体   中英

Do tornado AsyncHTTPClient fetch callbacks get called in order of request or response?

I'm using Tornado's AsyncHTTPClient to fetch a URL multiple times. I pass in a different callback with each request.

If I send requests A, B (with associated callbacks Callback_A and Callback_B) to a URL, but the responses come back in the opposite order B, A. Should I expect the callbacks to be called in the order of Callback_A, Callback_B or will they get called in the opposite order?

I'd like to have the callbacks called in the order of responses (so Callback_B, Callback_A). If that's not the default behavior is there a way to do that instead?

Callbacks are executed as soon as possible after the event for which they're waiting is complete. So, they are called in response order.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM