mirror of
https://git.phreedom.club/localhost_frssoft/FMN_bot.git
synced 2024-11-24 20:20:56 +01: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')
|
poll_created = get_state('poll_status_id')
|
||||||
stop_thread_scan = get_state('stop_thread_scan')
|
stop_thread_scan = get_state('stop_thread_scan')
|
||||||
time_now = int(time.time())
|
time_now = int(time.time())
|
||||||
|
reserve_time = False
|
||||||
while status_id is None or stop_thread_scan is None:
|
while status_id is None or stop_thread_scan is None:
|
||||||
fail_limit = Counter()
|
fail_limit = Counter()
|
||||||
status_id = get_state('last_thread_id')
|
status_id = get_state('last_thread_id')
|
||||||
|
@ -44,6 +45,7 @@ def scan_context_thread():
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
if time_now >= int(stop_thread_scan):
|
if time_now >= int(stop_thread_scan):
|
||||||
|
reserve_time = True
|
||||||
logger.debug('Сбор завершён, сканирование треда на опоздавших')
|
logger.debug('Сбор завершён, сканирование треда на опоздавших')
|
||||||
if poll_created is None:
|
if poll_created is None:
|
||||||
create_poll_movies()
|
create_poll_movies()
|
||||||
|
@ -54,6 +56,8 @@ def scan_context_thread():
|
||||||
else:
|
else:
|
||||||
endings = int(stop_thread_scan) - time_now
|
endings = int(stop_thread_scan) - time_now
|
||||||
logger.debug(f'Осталось до закрытия сбора: {endings}')
|
logger.debug(f'Осталось до закрытия сбора: {endings}')
|
||||||
|
if reserve_time: # Reduce instance load
|
||||||
|
time.sleep(30)
|
||||||
descendants = get_status_context(status_id)['descendants']
|
descendants = get_status_context(status_id)['descendants']
|
||||||
replyed = []
|
replyed = []
|
||||||
for status in descendants:
|
for status in descendants:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user