Skip to content

Commit

Permalink
Merge pull request #169 from JECSand/development
Browse files Browse the repository at this point in the history
Hardened retry
  • Loading branch information
JECSand authored Dec 13, 2023
2 parents 8e30334 + 7107eef commit 2c7cf9c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions yahoofinancials/cache.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
import time

import random
import peewee as _peewee
from threading import Lock
import os as _os
Expand Down Expand Up @@ -348,16 +348,17 @@ def initialise(self):
self.initialised = 0 # failure
return
i = 0
while i < 100:
while i < 150:
try:
db.connect()
Cookie_db_proxy.initialize(db)
db.create_tables([_CookieSchema])
self.initialised = 1 # success
return
except _peewee.OperationalError:
time.sleep(10)
time.sleep(random.randint(3, 15))
continue
self.initialised = 0 # failure


def lookup(self, strategy):
Expand Down

0 comments on commit 2c7cf9c

Please sign in to comment.