From d9b30f7cfe5e81283e46417d70c423efc6a8faa8 Mon Sep 17 00:00:00 2001 From: Tobias Svensson Date: Mon, 16 Sep 2013 13:58:01 +0100 Subject: [PATCH] Setup example code to boot bot, sidekiq & web app. --- examples/Procfile | 2 ++ examples/config.ru | 13 +++++++++++++ examples/{simple.rb => server.rb} | 12 +----------- examples/workers/simple.rb | 11 +++++++++++ 4 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 examples/Procfile create mode 100644 examples/config.ru rename examples/{simple.rb => server.rb} (56%) create mode 100644 examples/workers/simple.rb diff --git a/examples/Procfile b/examples/Procfile new file mode 100644 index 0000000..148cdd0 --- /dev/null +++ b/examples/Procfile @@ -0,0 +1,2 @@ +sidekiq: bundle exec sidekiq -r ./server.rb +web: bundle exec rackup \ No newline at end of file diff --git a/examples/config.ru b/examples/config.ru new file mode 100644 index 0000000..baf006d --- /dev/null +++ b/examples/config.ru @@ -0,0 +1,13 @@ +require 'sidekiq' +require 'sidetiq' + +require 'sidekiq/web' +require 'sidetiq/web' + +require './workers/simple.rb' + +Sidekiq.configure_client do |config| + config.redis = { :size => 1 } +end + +run Sidekiq::Web diff --git a/examples/simple.rb b/examples/server.rb similarity index 56% rename from examples/simple.rb rename to examples/server.rb index 949a5f1..eb3efae 100644 --- a/examples/simple.rb +++ b/examples/server.rb @@ -2,6 +2,7 @@ require 'sidekiq' require 'sidetiq' +require_relative 'workers/simple' Sidekiq.logger.level = Logger::DEBUG @@ -11,14 +12,3 @@ Sidekiq.configure_server do |config| Sidetiq.clock.start! end -class MyWorker - include Sidekiq::Worker - include Sidetiq::Schedulable - - recurrence { secondly } - - def perform(*args) - Sidekiq.logger.info "#perform" - end -end - diff --git a/examples/workers/simple.rb b/examples/workers/simple.rb new file mode 100644 index 0000000..dc34ff5 --- /dev/null +++ b/examples/workers/simple.rb @@ -0,0 +1,11 @@ +class Simple + include Sidekiq::Worker + include Sidetiq::Schedulable + + recurrence { secondly } + + def perform(*args) + Sidekiq.logger.info "#perform" + end +end +