genesisConfig request is made twice in OgmiosChainContext __init__
ross-spencer opened this issue · 3 comments
Describe the bug
A clear and concise description of what the bug is.
The genesisConfig query is made twice in the OgmiosChainContext init:
pycardano/pycardano/backend/ogmios.py
Lines 81 to 82 in 9b5d367
Via: self.genesis_param.
This could be held within a variable in the __init__ and then the attributes/dict values accessed independently.
To Reproduce
Steps to reproduce the behavior. e.g. A python script.
Create an OgmiosChainContext and inspect the websocket requests made during initialization.
Logs
If applicable, add logs to help explain your problem.
N/A.
Expected behavior
A clear and concise description of what you expected to happen.
The call should only be made once and the results accessed as many times as necessary for the genesisConfig. Alternatively, it should be made clearer in the docs/code if this is done for a specific reason.
Environment and software version (please complete the following information):
- OS: [e.g. Ubuntu 20.04.3 LTS, Mac OS 12.1]
- PyCardano Version [e.g. 0.1.1]
Python 3.10.12 + Pycardano 0.10.0.
Additional context
Add any other context about the problem here.
N/A.
genesis_param is a cached property, so it won't be called twice in context initiation.
so it won't be called twice in context initiation.
I'm seeing two web-socket calls here, it's the only reason I traced it back to the init but I'll double check and send my logging next week.
thanks for your patience @cffls, problem existed between user and keyboard. i was following some logic through incorrectly. Closing this.