Beem: discussions may fail to handle empty responses correctly

in #utopian-io6 years ago

Project Information

A GitHub issue as well as a PR to fix it were created. The PR was accepted/merged by the PO and will be part of the next beem release.

Expected behavior

discussions.Discussions_by_feed() should return an account's feed entries. If the account doesn't follow any other account, the result should be empty.

Actual behavior

discussions.Discussions_by_feed() returns an account's feed entries if there are entries available. If there are no entries available, beem iterates over all nodes and fails to return an empty result.

How to reproduce

from beem.discussions import Discussions_by_feed, Query
from beem.account import Account
account = Account('stmdev')
query = Query(limit=20, tag=account['name'])
for entry in Discussions_by_feed(query):
    print(entry)

Result:

Error: Empty Reply
Lost connection or internal error on node: wss://steemd.minnowsupportproject.org (1/-1) 

Error: Empty Reply
Lost connection or internal error on node: wss://rpc.steemviz.com (1/-1) 

Error: Empty Reply
Lost connection or internal error on node: wss://rpc.buildteam.io (1/-1) 

Error: Empty Reply
Lost connection or internal error on node: wss://steemd.privex.io (1/-1) 

Error: Empty Reply
Lost connection or internal error on node: https://api.steemit.com (1/-1) 

Error: Empty Reply
Lost connection or internal error on node: https://rpc.buildteam.io (1/-1) 

Error: Empty Reply
Lost connection or internal error on node: https://rpc.steemviz.com (1/-1) 
...

The reason is that beem by default switches to the next node if an RPC reply is empty. However, an empty reply is the correct reply in this case. Some classes in beem.discussions are missing the corresponding code to handle this situation:

        self.steem.rpc.set_next_node_on_empty_reply(self.steem.rpc.get_use_appbase())

Environment

  • beem master at rev. aa74d03
  • python 3.6.5

GitHub Account

https://github.com/crokkon

Sort:  

Thank you for contributing to Utopian!

Like all of your other submissions, this is an exceptional post. You got the details perfectly, with well defined behaviors, profesionally submitted tickets in github, and overall A+ quality. Your posts are an example for all of us bug hunters and Utopian contributors, about how to do things right.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Hey @stmdev
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.034
BTC 64455.55
ETH 3147.84
USDT 1.00
SBD 3.94