Skip to content

Instantly share code, notes, and snippets.

@kzkn
Created March 9, 2023 06:50
Show Gist options
  • Save kzkn/c526ac6f11de43fa056f8245572ddc37 to your computer and use it in GitHub Desktop.
Save kzkn/c526ac6f11de43fa056f8245572ddc37 to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
source "https://rubygems.org"
gem "sidekiq-scheduler"
:scheduler:
:schedule:
hello_world:
cron: '0 * * * * *' # Runs once per minute
class: HelloWorld
require 'sidekiq-scheduler'
Sidekiq.configure_server do |config|
config.redis = { url: ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } }
end
Sidekiq.configure_client do |config|
config.redis = { url: ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } }
end
class HelloWorld
include Sidekiq::Worker
def perform
puts "hello, world @#{Process.pid}"
end
end
#!/bin/sh
bundle exec sidekiq -C sidekiq.yml -r ./test.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment