Skip to content

Commit

Permalink
Update package.py
Browse files Browse the repository at this point in the history
  • Loading branch information
StrahinjaJacimovic authored Jun 6, 2024
1 parent a0f4ca2 commit c2733c9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/package.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os, sys, py7zr, requests
import os, sys, py7zr, requests, time

from elasticsearch import Elasticsearch

Expand Down Expand Up @@ -55,7 +55,17 @@ def get_release_id(repo, tag_name, token):
tag_name = sys.argv[3]

# Elasticsearch details
es = Elasticsearch([os.environ['ES_HOST']])
num_of_retries = 1
while True:
es = Elasticsearch([os.environ['ES_HOST']])
if es.ping():
break
# Wait for 30 seconds and try again if connection fails
if 10 == num_of_retries:
# Exit if it fails 10 times, something is wrong with the server
raise ValueError("Connection to ES failed!")
num_of_retries += 1
time.sleep(30)
index_name = os.environ['ES_INDEX']

# Assuming the repository is checked out at the root directory
Expand Down

0 comments on commit c2733c9

Please sign in to comment.