Commit 2de4c80f authored by Jérome Perrin's avatar Jérome Perrin

generic_mysql: shorter delays before retries

This mysql_update service retries every 30 seconds, but what usually
happens is that it starts at same time as mariadb, make a first attempt
at connect which fails because mariadb is not ready, sleep for 30
seconds, reties and succeed. Which is not efficient because we don't
need to wait for so long.
Instead of sleeping for 30 seconds between each retries, start with a
short delay and increase each time, but not more than 30 seconds.
parent 6d845c0d
Pipeline #8658 failed with stage
in 0 seconds
......@@ -5,7 +5,7 @@ import sys
import pytz
def updateMysql(mysql_upgrade_binary, mysql_binary, mysql_script_file):
sleep = 30
sleep = 0
with open(mysql_script_file) as script_file:
mysql_script = script_file.read()
mysql_list = mysql_binary, '-B'
......@@ -43,6 +43,7 @@ def updateMysql(mysql_upgrade_binary, mysql_binary, mysql_script_file):
break
print 'SlapOS initialisation script succesfully applied on database.'
return
sleep = max(sleep+1, 30)
print 'Sleeping for %ss and retrying' % sleep
sys.stdout.flush()
sys.stderr.flush()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment