From 2071d49b1801401f4e6e1376e5e76c27f952b046 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 12 Feb 2024 02:22:27 +0200 Subject: [PATCH] Added a connection close to avoid leaking mysql connections --- dst-domain-match-check.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dst-domain-match-check.rb b/dst-domain-match-check.rb index f1c9726..4486957 100755 --- a/dst-domain-match-check.rb +++ b/dst-domain-match-check.rb @@ -93,10 +93,15 @@ def check_domain_in_db(domain) sql_query = "SELECT * FROM #{$table_name} WHERE dstdom IN ( #{domains.map { |d| "'#{d}'" }.join(" , ")} )" log("Running SQL query: [ \"#{sql_query}\" ]") results = db_client.query(sql_query) - return false if results.nil? + if results.nil? + db_client.close + return false + end if results.size > 0 + db_client.close return true end + db_client.close return false end