Default to max gas oracle.
This commit is contained in:
parent
f67702cc79
commit
9398cd98d0
@ -17,7 +17,7 @@ from cic_eth_registry.error import UnknownContractError
|
|||||||
# local imports
|
# local imports
|
||||||
from cic_eth.error import SeppukuError
|
from cic_eth.error import SeppukuError
|
||||||
from cic_eth.db.models.base import SessionBase
|
from cic_eth.db.models.base import SessionBase
|
||||||
from cic_eth.eth.util import CacheGasOracle
|
from cic_eth.eth.util import CacheGasOracle, MaxGasOracle
|
||||||
|
|
||||||
#logg = logging.getLogger().getChild(__name__)
|
#logg = logging.getLogger().getChild(__name__)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
@ -41,21 +41,20 @@ class BaseTask(celery.Task):
|
|||||||
|
|
||||||
|
|
||||||
def create_gas_oracle(self, conn, address=None, *args, **kwargs):
|
def create_gas_oracle(self, conn, address=None, *args, **kwargs):
|
||||||
if address == None:
|
x = None
|
||||||
return RPCGasOracle(
|
if address is None:
|
||||||
|
x = RPCGasOracle(
|
||||||
conn,
|
conn,
|
||||||
code_callback=kwargs.get('code_callback', self.get_min_fee_limit),
|
code_callback=kwargs.get('code_callback', self.get_min_fee_limit),
|
||||||
min_price=self.min_fee_price,
|
min_price=self.min_fee_price,
|
||||||
id_generator=kwargs.get('id_generator'),
|
id_generator=kwargs.get('id_generator'),
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
|
||||||
return CacheGasOracle(
|
x = MaxGasOracle(conn)
|
||||||
conn,
|
x.code_callback = x.get_fee_units
|
||||||
address,
|
|
||||||
method=kwargs.get('method'),
|
return x
|
||||||
min_price=self.min_fee_price,
|
|
||||||
id_generator=kwargs.get('id_generator'),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def get_min_fee_limit(self, code):
|
def get_min_fee_limit(self, code):
|
||||||
@ -84,7 +83,7 @@ class BaseTask(celery.Task):
|
|||||||
)
|
)
|
||||||
s.apply_async()
|
s.apply_async()
|
||||||
|
|
||||||
|
|
||||||
class CriticalTask(BaseTask):
|
class CriticalTask(BaseTask):
|
||||||
retry_jitter = True
|
retry_jitter = True
|
||||||
retry_backoff = True
|
retry_backoff = True
|
||||||
@ -96,7 +95,7 @@ class CriticalSQLAlchemyTask(CriticalTask):
|
|||||||
sqlalchemy.exc.DatabaseError,
|
sqlalchemy.exc.DatabaseError,
|
||||||
sqlalchemy.exc.TimeoutError,
|
sqlalchemy.exc.TimeoutError,
|
||||||
sqlalchemy.exc.ResourceClosedError,
|
sqlalchemy.exc.ResourceClosedError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CriticalWeb3Task(CriticalTask):
|
class CriticalWeb3Task(CriticalTask):
|
||||||
@ -104,7 +103,7 @@ class CriticalWeb3Task(CriticalTask):
|
|||||||
ConnectionError,
|
ConnectionError,
|
||||||
)
|
)
|
||||||
safe_gas_threshold_amount = 60000 * 3
|
safe_gas_threshold_amount = 60000 * 3
|
||||||
safe_gas_refill_amount = safe_gas_threshold_amount * 5
|
safe_gas_refill_amount = safe_gas_threshold_amount * 5
|
||||||
safe_gas_gifter_balance = safe_gas_threshold_amount * 5 * 100
|
safe_gas_gifter_balance = safe_gas_threshold_amount * 5 * 100
|
||||||
|
|
||||||
|
|
||||||
@ -122,13 +121,13 @@ class CriticalSQLAlchemyAndSignerTask(CriticalTask):
|
|||||||
sqlalchemy.exc.DatabaseError,
|
sqlalchemy.exc.DatabaseError,
|
||||||
sqlalchemy.exc.TimeoutError,
|
sqlalchemy.exc.TimeoutError,
|
||||||
sqlalchemy.exc.ResourceClosedError,
|
sqlalchemy.exc.ResourceClosedError,
|
||||||
)
|
)
|
||||||
|
|
||||||
class CriticalWeb3AndSignerTask(CriticalWeb3Task):
|
class CriticalWeb3AndSignerTask(CriticalWeb3Task):
|
||||||
autoretry_for = (
|
autoretry_for = (
|
||||||
ConnectionError,
|
ConnectionError,
|
||||||
)
|
)
|
||||||
|
|
||||||
@celery_app.task()
|
@celery_app.task()
|
||||||
def check_health(self):
|
def check_health(self):
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user