Background_task не активируются каждые 30 секунд, как было запрошено
У меня есть фоновая задача, которая должна запускаться каждые 30 секунд. Я настроил его следующим образом:
from background_task import background
from datetime import datetime
import pytz
@background()
def notify_users(**kwargs):
my_datetime = datetime.now(pytz.timezone('US/Eastern'))
print ("at the moment its",my_datetime)
и активация:
notify_users(repeat=30, repeat_until=None)
Вывод следующий:
at the moment its 2022-01-02 15:08:25.571196-05:00
at the moment its 2022-01-02 15:08:55.896407-05:00
at the moment its 2022-01-02 15:09:56.408215-05:00
at the moment its 2022-01-02 15:10:56.871663-05:00
at the moment its 2022-01-02 15:11:57.327631-05:00
at the moment its 2022-01-02 15:12:57.857382-05:00
at the moment its 2022-01-02 15:13:28.135571-05:00
at the moment its 2022-01-02 15:14:28.551105-05:00
Обратите внимание, что он не 30 секунд, а только второй раунд, почему? что я здесь упускаю?