Clean up old examples

This commit is contained in:
Mike Perham 2019-08-28 10:19:39 -07:00
parent 978ce8e6cf
commit 73484bec33
5 changed files with 2 additions and 84 deletions

View File

@ -5,9 +5,7 @@
---
:verbose: false
:concurrency: 10
# Set timeout to 8 on Heroku, longer if you manage your own systems.
:timeout: 30
:timeout: 25
# Sidekiq will run this file through ERB when reading it so you can
# even put in dynamic logic, like a host-specific queue.

View File

@ -1,61 +0,0 @@
# Make sure you have Sinatra installed, then start sidekiq with
# ./bin/sidekiq -r ./examples/sinkiq.rb
# Simply run Sinatra with
# ruby examples/sinkiq.rb
# and then browse to http://localhost:4567
#
require 'sinatra'
require 'sidekiq'
require 'redis'
require 'sidekiq/api'
$redis = Redis.new
class SinatraWorker
include Sidekiq::Worker
def perform(msg="lulz you forgot a msg!")
$redis.lpush("sinkiq-example-messages", msg)
end
end
get '/' do
stats = Sidekiq::Stats.new
@failed = stats.failed
@processed = stats.processed
@messages = $redis.lrange('sinkiq-example-messages', 0, -1)
erb :index
end
post '/msg' do
SinatraWorker.perform_async params[:msg]
redirect to('/')
end
__END__
@@ layout
<html>
<head>
<title>Sinatra + Sidekiq</title>
<body>
<%= yield %>
</body>
</html>
@@ index
<h1>Sinatra + Sidekiq Example</h1>
<h2>Failed: <%= @failed %></h2>
<h2>Processed: <%= @processed %></h2>
<form method="post" action="/msg">
<input type="text" name="msg">
<input type="submit" value="Add Message">
</form>
<a href="/">Refresh page</a>
<h3>Messages</h3>
<% @messages.each do |msg| %>
<p><%= msg %></p>
<% end %>

View File

@ -48,7 +48,7 @@ reload signal TSTP
# Upstart waits 5 seconds by default to kill the a process. Increase timeout to
# give sidekiq process enough time to exit.
kill timeout 15
kill timeout 30
instance $index

View File

@ -1,5 +0,0 @@
source 'https://rubygems.org'
gem 'sidekiq', path: '../../'
gem 'thin'
gem 'pry'

View File

@ -1,14 +0,0 @@
require 'sidekiq/web'
require 'redis'
$redis = Redis.new
class SinatraWorker
include Sidekiq::Worker
def perform(msg="lulz you forgot a msg!")
$redis.lpush("sinkiq-example-messages", msg)
end
end
run Sidekiq::Web