Esempio n. 1
0
def schedule_vacuum():
    current_dt = local_now()
    vacuum_time = current_dt.replace(hour=3, minute=0, second=0, microsecond=0)
    if vacuum_time < current_dt:
        # If it is past 3AM, change the day to tomorrow.
        vacuum_time = vacuum_time + timedelta(days=1)
    # Repeat indefinitely
    scheduler.schedule(vacuum_time, perform_vacuum, repeat=None, interval=24 * 60 * 60)
Esempio n. 2
0
def schedule_ping(
    server=DEFAULT_SERVER_URL,
    checkrate=DEFAULT_PING_CHECKRATE,
    interval=DEFAULT_PING_INTERVAL,
):
    started = datetime.datetime.now()
    scheduler.schedule(
        started,
        _ping,
        interval=interval * 60,
        repeat=None,
        started=started,
        server=server,
        checkrate=checkrate,
    )