-
-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Runtime jobs performed at the same time #336
Comments
Have you tried to give your job distinct names? |
@c-rack Yes, I did but it didn't work. Quantum.Job.set_name(params["id"] |> String.to_atom) |
@mertkahyaoglu What do you mean when you say that they are waiting for the first one? They should all be executed at the same time (always at full 10 seconds (00, 10, 20, 30, 40, 50). |
@maennchen I don't want them to be executed at the same time. For example I add a job which is meant to run for every 10 seconds. After 5 seconds I add another job. I expect to see the last job to be executed 10 seconds after it is created but it is executed after 5 seconds together with the first one. How can these jobs be executed independently? |
@mertkahyaoglu The schedule There is no easy way to schedule something every 10 seconds after it was scheduled. This is also why we opened the issue #268. If you really want to use it this way, you could implement it via a little hack (pseudo code, not tested): Edit: Corrected Code %{second: second} = NaiveDateTime.utc_now()
second_remainder = rem(second, 10)
seconds = [
second_remainder,
second_remainder + 10,
second_remainder + 20,
second_remainder + 30,
second_remainder + 40,
second_remainder + 50
]
schedule = Crontab.CronExpression.Parser.parse!(Enum.join(seconds, ","), true)
Notifi.Scheduler.new_job()
|> Quantum.Job.set_name(:crawler)
|> Quantum.Job.set_schedule(schedule)
|> Quantum.Job.set_task(fn -> IO.puts "tick:" <> params["id"] end)
|> Notifi.Scheduler.add_job() |
@mertkahyaoglu Since this is already covered by #268, I'll close the issue. |
Hello everyone,
In my project, I'm adding a new job that runs every 10 seconds for every POST requests. Although these jobs are added in different times, they are executed at the same. The newly added ones are waiting for the first one to execute altogether. How can I make these jobs run independent from each other? I apologize if there is already an easy solution for this that I missed.
Here is the code that I'm using from the docs;
The text was updated successfully, but these errors were encountered: