question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Start job in specific time and run periodically every to 2 hours to 5 days

See original GitHub issue

i want to schedule a complex job that is firing in specific time and recurring every specific time for range of another time. example : fire alarm sound at 12:00 am and repeating every 2 hours and ending time of job is + 5days

when i setWindowExecution() or setExact() with setPeriodic() it’s throw exception exceptions: Can’t call setExecutionWindow() on a periodic job. Can’t require any condition for an exact job.

Here Is My Code JobRequest.Builder builder = new JobRequest.Builder(Constants.APP_JOB_TAG) .setExecutionWindow(startTime, endExecutionTime) // .setExact(startTime) .setBackoffCriteria(5_000L, JobRequest.BackoffPolicy.EXPONENTIAL) .setExtras(extras) .setRequirementsEnforced(true) .setUpdateCurrent(true); if (taskModel.getTask_repeat() > 0) { builder.setPeriodic(taskModel.getTask_repeat() + (2 * ONE_MINUTE_IN_MILLIS), taskModel.getTask_repeat()); } int jobId = builder.build().schedule();

do i miss understood something ? please help

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
ebnrdwancommented, May 13, 2018

@pedrodimoura thanks for helping out.

feature not supported yet, hope to be supported soon

1reaction
pedrodimouracommented, May 7, 2018

Hi, @ebnrdwan ! You can’t call setExecutionWindown on a periodic job. If you want to schedule a periodic job, just set a time interval in milliseconds on setPeriodic method.

For example, I have a job that execute every 15 minutes and 5 minutes flex time interval, check it out:

JobRequest.Builder(JobServiceSync.TAG).setPeriodic(TimeUnit.MINUTES.toMillis(15), TimeUnit.MINUTES.toMillis(5)).build();

And remember, when you use setPeriodic to schedule a job, the min. time interval is 15 minutes. This is a AlarmManager limitation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trigger Jenkins Job using "Build periodically" and "Poll SCM"
To the job every 5min past every hour(5th Minute of every Hour) 5 * * * *. To schedule your build every day...
Read more >
How to run cron every hour - with variations and examples
Jobs that are scheduled are known as cron jobs and are run periodically at fixed times, dates or intervals.
Read more >
Run CRON job everyday at specific time - Stack Overflow
Cron utility is an effective way to schedule a routine background job at a specific time and/or day on an on-going basis.
Read more >
Better Conditions for Scheduled Jobs (Specific tim...
Set the schedule job to RUN: Periodically ; Set the REPEAT INTERVAL to 0 Days, 1 Hours (this causes the script to check...
Read more >
How to Schedule a Jenkins Job: A Simple Guide | CloudBees
When your team starts using Jenkins, you'll see how quickly the game ... For example, a job that runs every hour from 9:00...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found