Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hivemind
Commits
3afc7a74
Commit
3afc7a74
authored
4 years ago
by
Dariusz Kędzierski
Browse files
Options
Downloads
Patches
Plain Diff
Children count fix
parent
890a998a
No related branches found
No related tags found
5 merge requests
!456
Release candidate v1 24
,
!230
Setup monitoring with pghero
,
!135
Enable postgres monitoring on CI server
,
!16
Dk issue 3 concurrent block query rebase
,
!15
Dk issue 3 concurrent block query
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hive/indexer/posts.py
+13
-7
13 additions, 7 deletions
hive/indexer/posts.py
hive/steem/http_client.py
+2
-1
2 additions, 1 deletion
hive/steem/http_client.py
with
15 additions
and
8 deletions
hive/indexer/posts.py
+
13
−
7
View file @
3afc7a74
...
@@ -323,16 +323,22 @@ class Posts:
...
@@ -323,16 +323,22 @@ class Posts:
@classmethod
@classmethod
def
update_child_count
(
cls
,
parent_id
,
op
=
'
+
'
):
def
update_child_count
(
cls
,
parent_id
,
op
=
'
+
'
):
"""
Increase/decrease child count by 1
"""
"""
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
=
"""
sql
=
"""
UPDATE
UPDATE
hive_posts
hive_posts
SET
"""
SET children = :children WHERE id = :id
"""
if
op
==
'
+
'
:
sql
+=
"""
children = (SELECT children FROM hive_posts WHERE id = :id) + 1
"""
DB
.
query
(
sql
,
id
=
parent_id
,
children
=
children
)
else
:
sql
+=
"""
children = (SELECT children FROM hive_posts WHERE id = :id) - 1
"""
sql
+=
"""
WHERE id = :id
"""
DB
.
query
(
sql
,
id
=
parent_id
)
@classmethod
@classmethod
def
undelete
(
cls
,
op
,
date
,
pid
):
def
undelete
(
cls
,
op
,
date
,
pid
):
...
...
This diff is collapsed.
Click to expand it.
hive/steem/http_client.py
+
2
−
1
View file @
3afc7a74
...
@@ -148,7 +148,8 @@ class HttpClient(object):
...
@@ -148,7 +148,8 @@ class HttpClient(object):
body_data
=
json
.
dumps
(
body
,
ensure_ascii
=
False
).
encode
(
'
utf8
'
)
body_data
=
json
.
dumps
(
body
,
ensure_ascii
=
False
).
encode
(
'
utf8
'
)
tries
=
0
tries
=
0
while
tries
<
100
:
# changed number of tries to 25
while
tries
<
25
:
tries
+=
1
tries
+=
1
secs
=
-
1
secs
=
-
1
info
=
None
info
=
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment