Fix dispatcher memory leak
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# external imports
|
||||
import celery
|
||||
from chainlib.eth.nonce import RPCNonceOracle
|
||||
from chainlib.eth.tx import (
|
||||
receipt,
|
||||
@@ -20,6 +21,7 @@ def test_translate(
|
||||
cic_registry,
|
||||
init_celery_tasks,
|
||||
register_lookups,
|
||||
celery_session_worker,
|
||||
):
|
||||
|
||||
nonce_oracle = RPCNonceOracle(contract_roles['CONTRACT_DEPLOYER'], eth_rpc)
|
||||
@@ -46,6 +48,20 @@ def test_translate(
|
||||
'recipient': agent_roles['BOB'],
|
||||
'recipient_label': None,
|
||||
}
|
||||
tx = translate_tx_addresses(tx, [contract_roles['CONTRACT_DEPLOYER']], default_chain_spec.asdict())
|
||||
assert tx['sender_label'] == 'alice'
|
||||
assert tx['recipient_label'] == 'bob'
|
||||
|
||||
#tx = translate_tx_addresses(tx, [contract_roles['CONTRACT_DEPLOYER']], default_chain_spec.asdict())
|
||||
s = celery.signature(
|
||||
'cic_eth.ext.address.translate_tx_addresses',
|
||||
[
|
||||
tx,
|
||||
[contract_roles['CONTRACT_DEPLOYER']],
|
||||
default_chain_spec.asdict(),
|
||||
],
|
||||
queue=None,
|
||||
)
|
||||
t = s.apply_async()
|
||||
r = t.get_leaf()
|
||||
assert t.successful()
|
||||
|
||||
assert r['sender_label'] == 'alice'
|
||||
assert r['recipient_label'] == 'bob'
|
||||
@@ -1,6 +1,7 @@
|
||||
# third-party imports
|
||||
# extended imports
|
||||
import pytest
|
||||
import uuid
|
||||
import unittest
|
||||
|
||||
# local imports
|
||||
from cic_eth.db.models.nonce import (
|
||||
@@ -55,7 +56,7 @@ def test_nonce_reserve(
|
||||
o = q.first()
|
||||
assert o.nonce == 43
|
||||
|
||||
nonce = NonceReservation.release(eth_empty_accounts[0], str(uu))
|
||||
nonce = NonceReservation.release(eth_empty_accounts[0], str(uu), session=init_database)
|
||||
init_database.commit()
|
||||
assert nonce == (str(uu), 42)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user