forked from mattyr/sidecloq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
54 lines (46 loc) · 1.01 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
require 'bundler/gem_tasks'
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'test'
t.libs << 'lib'
t.test_files = FileList['test/**/test_*.rb']
end
task default: :test
desc 'Run the Sidekiq web interface (w/Sidecloq)'
task :web do
require 'sidekiq'
require 'sidecloq'
Sidekiq.configure_client do |config|
config.redis = {
url: 'redis://localhost:6379/0',
size: 1
}
end
# throw a fake job in
Sidecloq.configure do |config|
sched = Sidecloq::Schedule.from_hash({
my_scheduled_job: {
class: 'DoWork',
cron: '* * * * *',
queue: 'default'
}
})
sched.save_redis
config[:schedule] = sched
end
class DoWork
include Sidekiq::Worker
end
require 'rack/server'
require 'rack/session/cookie'
require 'sidekiq/web'
require 'sidecloq/web'
Rack::Server.start(
app: Rack::Session::Cookie.new(
Sidekiq::Web,
secret: SecureRandom.hex(32),
same_site: true,
max_age: 86400
)
)
end