Clockwork is a cron replacement. It runs as a ruby process and can be used for scheduling recurring tasks, such as asynchronous worker jobs.
Questions tagged [clockwork]
67 questions
45
votes
1 answer
Logging in delayed_job?
I can't get any log output from delayed_job, and I'm not sure my jobs are starting.
Here's my Procfile:
web: bundle exec rails server
worker: bundle exec rake jobs:work
worker: bundle exec clockwork app/clock.rb
And here's the job:
class…

Stefan Kendall
- 66,414
- 68
- 253
- 406
13
votes
2 answers
Heroku clock process: how to ensure jobs weren't skipped?
I'm building a Heroku app that relies on scheduled jobs. We were previously using Heroku Scheduler but clock processes seem more flexible and robust. So now we're using a clock process to enqueue background jobs at specific times/intervals.
Heroku's…

oregontrail256
- 657
- 1
- 6
- 14
7
votes
1 answer
Rails clockwork not running code
I'm using the gem 'clockwork' in a Rails 3.2 app. The app is running on Heroku. The clock job runs at 1am - but it's not executing the code.
Here is the clock.rb code:
Clockwork.every(1.day, 'DailyJob', :at => '01:00'){
…

Reddirt
- 5,913
- 9
- 48
- 126
6
votes
1 answer
Does Clockwork require its own process?
I've seen people say in a couple of different places that clockwork should be run on its own dyno, with a procfile that might look something like this (example from heroku):
clock: bundle exec clockwork lib/clock.rb
Is there any reason not to run…

toddmetheny
- 4,405
- 1
- 22
- 39
5
votes
0 answers
log rotation inter-process lock failed opswork clockwork
I am using opswork with t2.medium machine with ruby clockwork running in it.
every 30 seconds we are triggering a job.
SPAWNED BG JOB FOR TASK: 20 for SC: 20 with Sidekiq id: 3afda705eaf597edb4bcc257
log rotation inter-process lock failed. No such…

shakeel
- 801
- 1
- 8
- 24
5
votes
4 answers
How to assure the same job doesn't run twice at the same time?
I have a simple sidekiq job that I've set to run every 5 minutes using clockwork. What I'm worried about is that, if the job takes longer than 5 minutes, it will run again, which could cause some issues if it's running at the same time as the…

Cisplatin
- 2,860
- 3
- 36
- 56
5
votes
2 answers
Clockwork to queue ActiveJob background jobs
Running Rails 4.2.0 so I am using the ActiveJob w/ Sidekiq backend. I need to invoke regularly scheduled background jobs so I am hoping to use Clockwork, but I haven't seen any examples of how to use it with ActiveJob.
Here is my lib/clock.rb based…

omencat
- 1,155
- 1
- 11
- 18
4
votes
1 answer
How to trigger Clockwork task at the beginning of the month?
I would like to run task every beginning of the month. E.g.:
2017-01-01 00:00:00 // January has just started
2017-02-01 00:00:00 // February has just started ...
...
How to do this using clockwork?

knagode
- 5,816
- 5
- 49
- 65
4
votes
0 answers
How to find bottleneck in Laravel?
I have a large application written using Laravel 5.2. The application seems to be running good for a while "day or two" and then it starts slowing down "each request table 15+ seconds."
I am trying to figure out what could be causing the speed…

Junior
- 11,602
- 27
- 106
- 212
3
votes
2 answers
If I schedule a worker to run every day on Heroku, how can I be sure it doesn't run twice or get skipped?
I'm a bit confused as to how Clockwork, Sidekiq, and Redis all fit together on Heroku given that Heroku restarts dynos at least once a day.
Say I have a worker that runs once a day, so it's configured in config/clock.rb as:
module Clockwork
…

Benjamin Humphrey
- 3,770
- 2
- 23
- 41
3
votes
1 answer
Scheduling with Clockwork/Delayed_Job/ActiveJob to run every 5 minutes (round)
I am reading some sensor values and I want to schedule recurring jobs in order to repeat every :00, :10, :15, :20, :25, :30, :35 etc.
I am using clockwork/delayed_job/activeJob & foreman in Rails 5 and I am able to retrieve and store values to the…

ftshtw
- 629
- 1
- 5
- 19
3
votes
0 answers
Clockwork gem "at:" time not triggering events
My clockwork script.rb looks like:
module Clockwork
configure do |config|
config[:sleep_timeout] = 1
config[:tz] = 'EST'
config[:max_threads] = 15
config[:thread] = true
end
handler do |job|
puts 'job triggered'
end
…

Jonah
- 15,806
- 22
- 87
- 161
3
votes
2 answers
Laravel disable provider (Clockwork) on fly
I'm having a laravel setup with the Clockwork installed.
And I have a artisan command that takes really long time to run, so that clockwork will consume too much memory.
I still need that extension.
How can I disable it when just running a command?

Konstantin Bodnia
- 1,372
- 3
- 20
- 43
3
votes
0 answers
Clockwork not logging to Heroku console
I am using the Clockwork gem to run a series of rake tasks. All looks good, but it seems the puts commands dont appear in the logs, and was just wondering if anyone had any idea why?
require File.expand_path('../../config/boot', …

bnussey
- 1,894
- 1
- 19
- 34
3
votes
1 answer
Schedule clockwork to run only on a specific date of the year
I been trying schedule a job with clockwork to run only on day eg. February 14. But I'm not sure if is this possible because the documentation formats do not have this possibility.
I know that I can do something like this:
Clockwork.every(1.day,…

monteirobrena
- 2,562
- 1
- 33
- 45