mirror of
https://gitea.phreedom.club/localhost_frssoft/FMN_bot.git
synced 2024-11-22 02:41:28 +00:00
Reduce call thread-context api, after scan done
This commit is contained in:
parent
de6c3eb8fa
commit
e4a5534edd
|
@ -37,6 +37,7 @@ def scan_context_thread():
|
|||
poll_created = get_state('poll_status_id')
|
||||
stop_thread_scan = get_state('stop_thread_scan')
|
||||
time_now = int(time.time())
|
||||
reserve_time = False
|
||||
while status_id is None or stop_thread_scan is None:
|
||||
fail_limit = Counter()
|
||||
status_id = get_state('last_thread_id')
|
||||
|
@ -44,6 +45,7 @@ def scan_context_thread():
|
|||
time.sleep(1)
|
||||
|
||||
if time_now >= int(stop_thread_scan):
|
||||
reserve_time = True
|
||||
logger.debug('Сбор завершён, сканирование треда на опоздавших')
|
||||
if poll_created is None:
|
||||
create_poll_movies()
|
||||
|
@ -54,6 +56,8 @@ def scan_context_thread():
|
|||
else:
|
||||
endings = int(stop_thread_scan) - time_now
|
||||
logger.debug(f'Осталось до закрытия сбора: {endings}')
|
||||
if reserve_time: # Reduce instance load
|
||||
time.sleep(30)
|
||||
descendants = get_status_context(status_id)['descendants']
|
||||
replyed = []
|
||||
for status in descendants:
|
||||
|
|
Loading…
Reference in a new issue