Skip to content

[BUG] - NextRun() method returning a value in the past when using a locker. #828

@manuelarte

Description

@manuelarte

Describe the bug

When I call the method NextRun() in a job I get a timestamp in the past. I think it's related to the fact that I am using a gocron.Locker and that particular instance does not get to do the job.
Then I can have the scenario that if for example, if my project have two instances, and I am exposing the nextRun value through an endpoint, the values are different for each instance.

I think I am not explaining myself very good, so that's why I created a repo to show it live, link below.

To Reproduce

I created a gist to describe the scenario:
https://gist.github.com/manuelarte/e33cec46cd8653a5e2731687041a051a

Version

github.com/go-co-op/gocron/v2 v2.15.0

Expected behavior

I would expect the NextRun value to be the same independently if that particular instance got the job last time or not.

Additional context

As mentioned before, I created a repo to easily show the issue https://github.com/manuelarte/cron-job-next-run-issue

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