Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better error handling - while establishing connection #153

Open
bobinson opened this issue Oct 13, 2018 · 4 comments
Open

better error handling - while establishing connection #153

bobinson opened this issue Oct 13, 2018 · 4 comments

Comments

@bobinson
Copy link
Contributor

Right now while establishing connection if tinman receives an error from the server like the example, given below, the connection is aborted. While once the connection is establishes we are retrying for MAX_RETRY times. In a similar fashion, if we retry or wait a few seconds based on the error message from the server, that will be helpful.

A useful scenario is when an automated test is run, messages like 'Unable to acquire database lock' can be used to continue trying to start the test using tinman instead of just aborting.



[09:29 PM] bobinson@air 🖖  [~/hack/tinman]python -m tinman snapshot -s https://testnet.steemitdev.com -o snapshot.json
Traceback (most recent call last):
  File "/Users/user/.pyenv/versions/3.6.5/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/user/.pyenv/versions/3.6.5/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/user/hack/tinman/tinman/__main__.py", line 4, in <module>
    main.sys_main()
  File "/Users/user/hack/tinman/tinman/main.py", line 55, in sys_main
    result = main(sys.argv)
  File "/Users/user/hack/tinman/tinman/main.py", line 52, in main
    return module.main(argv[1:])
  File "/Users/user/hack/tinman/tinman/snapshot.py", line 134, in main
    dump_dgpo(steemd, outfile)
  File "/Users/user/hack/tinman/tinman/snapshot.py", line 113, in dump_dgpo
    dgpo = steemd.database_api.get_dynamic_global_properties(x=None)
  File "/Users/b5413b/hack/tinman/simple_steem_client/client.py", line 225, in __call__
    method_kwargs=kwargs,
  File "/Users/user/hack/tinman/simple_steem_client/client.py", line 179, in rpc_call
    raise SteemRPCException(resp)
simple_steem_client.client.SteemRPCException: OrderedDict([('jsonrpc', '2.0'), ('error', OrderedDict([('code', -32003), ('message', 'Unable to acquire database lock')])), ('id', 0)])
@bobinson bobinson changed the title retrying on receiveing errors from the server side better eror handling - while establishing connection Oct 13, 2018
@bobinson bobinson changed the title better eror handling - while establishing connection better error handling - while establishing connection Oct 13, 2018
@inertia186
Copy link
Contributor

The problem here is that the retry logic is consentrated in snapshot.list_all_accounts. A more comprehensive approach would be to place the retry logic in simple_steem_client. But then the simple client wouldn't be quite as simple.

I would actually prefer to generalize the retry logic in tinman (without excessive boiler plate).

@bobinson
Copy link
Contributor Author

I would actually prefer to generalize the retry logic in tinman (without excessive boiler plate).

agree.

@relativityboy
Copy link
Contributor

@bobinson - is that something you'd be interested in working on? We could create an issue with some very clear acceptance criteria.

@bobinson
Copy link
Contributor Author

@relativityboy - yes, I will be interested in giving it a try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants