From 07bf8d4bb38355f2ee25cb009178661ffdcee990 Mon Sep 17 00:00:00 2001 From: Aiee <18348405+Aiee@users.noreply.github.com> Date: Fri, 26 Nov 2021 16:10:35 +0800 Subject: [PATCH] Add logs for invalid value handling --- src/graph/session/GraphSessionManager.cpp | 3 +++ tests/admin/test_configs.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/graph/session/GraphSessionManager.cpp b/src/graph/session/GraphSessionManager.cpp index a5faa5c22b5..c11003d9eb1 100644 --- a/src/graph/session/GraphSessionManager.cpp +++ b/src/graph/session/GraphSessionManager.cpp @@ -151,7 +151,10 @@ void GraphSessionManager::threadFunc() { // TODO(dutor) Now we do a brute-force scanning, of course we could make it more // efficient. void GraphSessionManager::reclaimExpiredSessions() { + DCHECK_GT(FLAGS_session_idle_timeout_secs, 0); if (FLAGS_session_idle_timeout_secs == 0) { + LOG(ERROR) << "Program should not reach here, session_idle_timeout_secs should be an integer " + "between 1 and 604800"; return; } diff --git a/tests/admin/test_configs.py b/tests/admin/test_configs.py index 3baaedba9ec..600d4f0eee2 100644 --- a/tests/admin/test_configs.py +++ b/tests/admin/test_configs.py @@ -37,6 +37,8 @@ def test_configs(self): self.check_resp_succeeded(resp) # update flag to an invalid value, expected to fail + resp = self.client.execute('UPDATE CONFIGS graph:session_idle_timeout_secs={}'.format(0)) + self.check_resp_failed(resp) resp = self.client.execute('UPDATE CONFIGS graph:session_idle_timeout_secs={}'.format(999999)) self.check_resp_failed(resp)