Skip to content

Commit

Permalink
Merge pull request #219 from aleksandrkaekhtin/hotfix/get_update_time
Browse files Browse the repository at this point in the history
Update get_update_time
  • Loading branch information
aleksandrkaekhtin authored Oct 16, 2024
2 parents 7ce4a04 + 35422db commit d4499a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion backends/toncenter_cpp/apps_v2_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ def __init__(self, connection):
Update time for auxiliary table with messages
"""
def get_update_time(self, config: SeasonConfig):
return 1726138800
with self.connection.cursor(cursor_factory=psycopg2.extras.RealDictCursor) as cursor:
cursor.execute("""
select gen_utime as last_time from blocks
where workchain = -1 and shard = -9223372036854775808 order by seqno desc limit 1
""")
return cursor.fetchone()['last_time']

def _do_calculate(self, config: SeasonConfig, dry_run: bool = False):

Expand Down
6 changes: 3 additions & 3 deletions backends/toncenter_cpp/apps_v2_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def __init__(self, connection, produce_output=False):
"""
def get_update_time(self, config: SeasonConfig):
with self.connection.cursor(cursor_factory=psycopg2.extras.RealDictCursor) as cursor:
cursor.execute(f"""
select gen_utime as last_time from blocks
where workchain = -1 order by gen_utime desc limit 1
cursor.execute("""
select gen_utime as last_time from blocks
where workchain = -1 and shard = -9223372036854775808 order by seqno desc limit 1
""")
return cursor.fetchone()['last_time']

Expand Down
4 changes: 2 additions & 2 deletions backends/toncenter_cpp/nfts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def __init__(self, connection):
def get_update_time(self, config: SeasonConfig):
with self.connection.cursor(cursor_factory=psycopg2.extras.RealDictCursor) as cursor:
cursor.execute("""
select gen_utime as last_time from blocks
where workchain = -1 order by gen_utime desc limit 1
select gen_utime as last_time from blocks
where workchain = -1 and shard = -9223372036854775808 order by seqno desc limit 1
""")
return cursor.fetchone()['last_time']

Expand Down

0 comments on commit d4499a4

Please sign in to comment.