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