diff options
author | dormando <dormando@rydia.net> | 2022-02-11 11:07:58 -0800 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2022-02-11 16:48:34 -0800 |
commit | e03751b2c411dd69325cbb634ef6fc996a9518b2 (patch) | |
tree | 67c1283e2861d177d302ca470caf0741cc79660f /proto_proxy.c | |
parent | 0b35fb967a5088109d5237b00c8ef168a56a6f9a (diff) | |
download | memcached-e03751b2c411dd69325cbb634ef6fc996a9518b2.tar.gz |
proxy: enable backend_total stat
Diffstat (limited to 'proto_proxy.c')
-rw-r--r-- | proto_proxy.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/proto_proxy.c b/proto_proxy.c index 22703b0..24e6180 100644 --- a/proto_proxy.c +++ b/proto_proxy.c @@ -2853,6 +2853,10 @@ static int mcplib_backend_gc(lua_State *L) { mcmc_disconnect(be->client); free(be->client); + // FIXME (v2): upvalue for global ctx. + proxy_ctx_t *ctx = settings.proxy_ctx; + STAT_DECR(ctx, backend_total, 1); + return 0; } @@ -2882,10 +2886,6 @@ static int mcplib_backend(lua_State *L) { // This might shift to internal objects? mcp_backend_t *be = lua_newuserdatauv(L, sizeof(mcp_backend_t), 0); - if (be == NULL) { - proxy_lua_error(L, "out of memory allocating backend"); - return 0; - } // FIXME (v2): remove some of the excess zero'ing below? memset(be, 0, sizeof(mcp_backend_t)); @@ -2945,6 +2945,10 @@ static int mcplib_backend(lua_State *L) { lua_settable(L, lua_upvalueindex(MCP_BACKEND_UPVALUE)); // stack is back to having backend on the top. + // FIXME (v2): upvalue for global ctx. + proxy_ctx_t *ctx = settings.proxy_ctx; + STAT_INCR(ctx, backend_total, 1); + return 1; } |