Created
March 9, 2023 06:50
-
-
Save kzkn/c526ac6f11de43fa056f8245572ddc37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
source "https://rubygems.org" | |
gem "sidekiq-scheduler" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:scheduler: | |
:schedule: | |
hello_world: | |
cron: '0 * * * * *' # Runs once per minute | |
class: HelloWorld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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