diff options
author | dormando <dormando@rydia.net> | 2022-11-22 22:52:08 -0800 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2022-12-01 22:07:32 -0800 |
commit | 1ba5df8410e7ccc035390438e45b26c2d11ede5c (patch) | |
tree | ff0e1b06e15c411d8418a94e762cc7744fd12f07 /proxy_network.c | |
parent | 683bb98a55ba19f69c4e2a60b9104ed2edc971c3 (diff) | |
download | memcached-1ba5df8410e7ccc035390438e45b26c2d11ede5c.tar.gz |
proxy: add mcp.AWAIT_BACKGROUND
mcp.await(request, pools, 0, mcp.AWAIT_BACKGROUND) will, instead of
waiting on any request to return, simply return an empty table as soon
as the background requests are dispatched.
Diffstat (limited to 'proxy_network.c')
-rw-r--r-- | proxy_network.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/proxy_network.c b/proxy_network.c index c2e8555..9d885e6 100644 --- a/proxy_network.c +++ b/proxy_network.c @@ -63,15 +63,23 @@ static int _proxy_event_handler_dequeue(proxy_event_thread_t *t) { while (!STAILQ_EMPTY(&head)) { io_pending_proxy_t *io = STAILQ_FIRST(&head); io->flushed = false; - mcp_backend_t *be = io->backend; - // So the backend can retrieve its event base. - be->event_thread = t; // _no_ mutex on backends. they are owned by the event thread. STAILQ_REMOVE_HEAD(&head, io_next); // paranoia about moving items between lists. io->io_next.stqe_next = NULL; + // Need to check on await's before looking at backends, in case it + // doesn't have one. + // Here we're letting an await resume without waiting on the network. + if (io->await_background) { + return_io_pending((io_pending_t *)io); + continue; + } + + mcp_backend_t *be = io->backend; + // So the backend can retrieve its event base. + be->event_thread = t; if (be->bad) { P_DEBUG("%s: fast failing request to bad backend\n", __func__); io->client_resp->status = MCMC_ERR; |