From: Oshry Avraham Date: Tue, 28 Jan 2025 22:58:18 +0000 (+0200) Subject: rgw/lua: Fix - Reset Lua background start time for accurate time limit X-Git-Tag: v20.0.0~36^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3dbc971f8b6092d2de43e727774c4ab50f31bc1d;p=ceph.git rgw/lua: Fix - Reset Lua background start time for accurate time limit Resolved an issue where the Lua background would always exceed the execution time limit. Signed-off-by: Oshrey Avraham --- diff --git a/src/rgw/rgw_lua_background.cc b/src/rgw/rgw_lua_background.cc index 8121a774332..9182ba45b37 100644 --- a/src/rgw/rgw_lua_background.cc +++ b/src/rgw/rgw_lua_background.cc @@ -154,6 +154,7 @@ void Background::run() { ldpp_dout(dpp, 10) << "Lua background thread resumed" << dendl; } + lguard.reset_start_time(); const auto rc = read_script(); if (rc == -ENOENT || rc == -EAGAIN) { // either no script or paused, nothing to do diff --git a/src/rgw/rgw_lua_utils.h b/src/rgw/rgw_lua_utils.h index be7c13b20e2..5a3ce96a926 100644 --- a/src/rgw/rgw_lua_utils.h +++ b/src/rgw/rgw_lua_utils.h @@ -70,7 +70,7 @@ void stack_dump(lua_State* L); class lua_state_guard { const std::size_t max_memory; const std::chrono::milliseconds max_runtime; - const ceph::real_clock::time_point start_time; + ceph::real_clock::time_point start_time; const DoutPrefixProvider* const dpp; lua_State* const state; @@ -82,6 +82,7 @@ class lua_state_guard { const DoutPrefixProvider* _dpp); ~lua_state_guard(); lua_State* get() { return state; } + void reset_start_time() { start_time = ceph::real_clock::now(); } }; int dostring(lua_State* L, const char* str);