Skip to content

Commit

Permalink
added timeout to es check
Browse files Browse the repository at this point in the history
  • Loading branch information
shirosaidev committed Jun 22, 2024
1 parent bd2b8ec commit 5cbce96
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions diskover/diskover_elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ def elasticsearch_connection():
url = scheme + '://' + config['ES_HOST'] + ':' + str(config['ES_PORT'])
try:
if (config['ES_SSLVERIFICATION']):
r = requests.get(url, auth=(config['ES_USER'], config['ES_PASS']))
r = requests.get(url, auth=(config['ES_USER'], config['ES_PASS']), verify=True, timeout=config['ES_TIMEOUT'])
else:
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
r = requests.get(url, auth=(config['ES_USER'], config['ES_PASS']), verify=False)
r = requests.get(url, auth=(config['ES_USER'], config['ES_PASS']), verify=False, timeout=config['ES_TIMEOUT'])
except Exception as e:
print('Error connecting to Elasticsearch at {0}, check config and Elasticsearch is running. (Error: {1})'.format(url, e))
sys.exit(1)
Expand Down

0 comments on commit 5cbce96

Please sign in to comment.