Skip to content

[BUG] repeat_every runs 4x per minute when specified to repeat every 60sec #257

@thomashrabe

Description

@thomashrabe

Describe the bug
I'm using repeat_every as in

@app.on_event("startup")
@repeat_every(seconds=60)
def scrumbot_alert():
    """
    Sends alert
    """
    now_tz = datetime.datetime.utcnow().astimezone(pytz.timezone(timezone))
    logging.error(now_tz)
    alert()

But when I put a log to track when that function is run, I get 4 logs for every minute.

ERROR:root:2022-04-15 08:20:28.842180-07:00
ERROR:root:2022-04-15 08:20:30.325091-07:00
ERROR:root:2022-04-15 08:20:35.036041-07:00
ERROR:root:2022-04-15 08:20:35.333271-07:00
ERROR:root:2022-04-15 08:21:28.843411-07:00
ERROR:root:2022-04-15 08:21:30.326840-07:00
ERROR:root:2022-04-15 08:21:35.037719-07:00
ERROR:root:2022-04-15 08:21:35.334868-07:00
ERROR:root:2022-04-15 08:22:28.844427-07:00
ERROR:root:2022-04-15 08:22:30.333721-07:00
ERROR:root:2022-04-15 08:22:35.039823-07:00
ERROR:root:2022-04-15 08:22:35.337983-07:00

Expected behavior
Should see only one log per minute

Environment:
OS: Ubuntu 20.04
fastapi utils: 0.2.1
fastapi: 0.60.1
pydantic: 1.4
python: 3.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions