Added a connection close to avoid leaking mysql connections

This commit is contained in:
root 2024-02-12 02:22:27 +02:00
parent 76f80433df
commit 2071d49b18

View File

@ -93,10 +93,15 @@ def check_domain_in_db(domain)
sql_query = "SELECT * FROM #{$table_name} WHERE dstdom IN ( #{domains.map { |d| "'#{d}'" }.join(" , ")} )" sql_query = "SELECT * FROM #{$table_name} WHERE dstdom IN ( #{domains.map { |d| "'#{d}'" }.join(" , ")} )"
log("Running SQL query: [ \"#{sql_query}\" ]") log("Running SQL query: [ \"#{sql_query}\" ]")
results = db_client.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 if results.size > 0
db_client.close
return true return true
end end
db_client.close
return false return false
end end