diff --git a/hive/indexer/posts.py b/hive/indexer/posts.py index 0a219c53e2b38b2749c62439ed5c6b3721e50908..64da8b4e34fb059c5f805da07bed3193b9944e9d 100644 --- a/hive/indexer/posts.py +++ b/hive/indexer/posts.py @@ -323,16 +323,22 @@ class Posts: @classmethod def update_child_count(cls, parent_id, op='+'): """ Increase/decrease child count by 1 """ + sql = """SELECT children FROM hive_posts WHERE id = :id""" + children = int(DB.query(sql, id=parent_id)) + if children == 32767: + children = 0 + + if op == '+': + children += 1 + else: + children -= 1 + sql = """ UPDATE hive_posts - SET """ - if op == '+': - sql += """children = (SELECT children FROM hive_posts WHERE id = :id) + 1""" - else: - sql += """children = (SELECT children FROM hive_posts WHERE id = :id) - 1""" - sql += """ WHERE id = :id""" - DB.query(sql, id=parent_id) + SET children = :children WHERE id = :id""" + + DB.query(sql, id=parent_id, children=children) @classmethod def undelete(cls, op, date, pid): diff --git a/hive/steem/http_client.py b/hive/steem/http_client.py index 1233ec439d3cf3cc7b99e3ea102c838adee5147f..ed7fc6236e7421aea042967cebe8c7bb36995cdc 100644 --- a/hive/steem/http_client.py +++ b/hive/steem/http_client.py @@ -148,7 +148,8 @@ class HttpClient(object): body_data = json.dumps(body, ensure_ascii=False).encode('utf8') tries = 0 - while tries < 100: + # changed number of tries to 25 + while tries < 25: tries += 1 secs = -1 info = None