Retry init db on startup so that itest passes (#1532)

This commit is contained in:
Jonathan Zernik 2021-10-07 19:29:31 -07:00 committed by GitHub
parent 8d0d658e4d
commit 7a88fd95ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,6 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import logging
import time
from squeak.params import SelectParams
@ -111,7 +112,13 @@ class SqueakNode:
connection_string))
engine = get_engine(connection_string)
self.squeak_db = SqueakDb(engine)
self.squeak_db.init()
for _ in range(10):
try:
self.squeak_db.init()
break
except Exception:
logger.exception("Failed to initialize database.")
time.sleep(10)
def initialize_lightning_client(self):
# load the lightning client