summaryrefslogtreecommitdiff
path: root/proxy_await.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2022-12-01 16:00:42 -0800
committerdormando <dormando@rydia.net>2022-12-01 16:00:42 -0800
commit5468b726004aa9651ad77ec3db2dbb9859137b53 (patch)
tree6abccfa43dea5e5cde8ffffbe79d52151794bd7e /proxy_await.c
parent20cf8989cad866c9ffa0afbf8b06f843e33cc850 (diff)
downloadmemcached-5468b726004aa9651ad77ec3db2dbb9859137b53.tar.gz
proxy: add proxy_await_active stat
proxy_req_active shows the number of active proxy requests, but if those proxy requests make sub-requests via mcp.await() they are not accounted for. This gives the number of await's active, but not the total number of in-flight async requests.
Diffstat (limited to 'proxy_await.c')
-rw-r--r--proxy_await.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/proxy_await.c b/proxy_await.c
index 8eb5aa6..1486068 100644
--- a/proxy_await.c
+++ b/proxy_await.c
@@ -182,6 +182,7 @@ static void mcp_queue_await_io(conn *c, lua_State *Lc, mcp_request_t *rq, int aw
// places. Else these errors currently crash the daemon.
int mcplib_await_run(conn *c, mc_resp *resp, lua_State *L, int coro_ref) {
P_DEBUG("%s: start\n", __func__);
+ WSTAT_INCR(c, proxy_await_active, 1);
mcp_await_t *aw = lua_touserdata(L, -1);
int await_ref = luaL_ref(L, LUA_REGISTRYINDEX); // await is popped.
assert(aw != NULL);
@@ -365,6 +366,7 @@ int mcplib_await_return(io_pending_proxy_t *p) {
luaL_unref(L, LUA_REGISTRYINDEX, aw->argtable_ref);
luaL_unref(L, LUA_REGISTRYINDEX, aw->req_ref);
luaL_unref(L, LUA_REGISTRYINDEX, p->await_ref);
+ WSTAT_DECR(p->c, proxy_await_active, 1);
}
// Just remove anything we could have left on the primary VM stack