mirror of
https://github.com/discourse/discourse.git
synced 2025-04-28 23:14:34 +08:00
added EMBED_CLOCKWORK so users can embed clockwork scheduling inside another process
This commit is contained in:
parent
e993d6b29b
commit
21bfb64a28
@ -121,6 +121,18 @@ module Discourse
|
|||||||
# So open id logs somewhere sane
|
# So open id logs somewhere sane
|
||||||
config.after_initialize do
|
config.after_initialize do
|
||||||
OpenID::Util.logger = Rails.logger
|
OpenID::Util.logger = Rails.logger
|
||||||
|
|
||||||
|
if ENV['EMBED_CLOCKWORK']
|
||||||
|
puts ">> Running clockwork in background thread"
|
||||||
|
require_relative "clock"
|
||||||
|
|
||||||
|
Thread.new do
|
||||||
|
Clockwork.run
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
require 'clockwork'
|
require 'clockwork'
|
||||||
require_relative 'boot'
|
unless ENV['EMBED_CLOCKWORK']
|
||||||
require_relative 'environment'
|
require_relative 'boot'
|
||||||
|
require_relative 'environment'
|
||||||
|
end
|
||||||
|
|
||||||
# These are jobs you should run on a regular basis to make your
|
# These are jobs you should run on a regular basis to make your
|
||||||
# forum work properly.
|
# forum work properly.
|
||||||
|
@ -34,6 +34,14 @@ And you can try to set up following components manually on it:
|
|||||||
- Run a clockwork process for enqueing scheduled jobs
|
- Run a clockwork process for enqueing scheduled jobs
|
||||||
- Run several Rails processes, preferably behind a proxy like Nginx.
|
- Run several Rails processes, preferably behind a proxy like Nginx.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Low memory installs
|
||||||
|
|
||||||
|
- Clockwork can run inside your web server, if you launch the your web server with EMBED_CLOCKWORK=1,
|
||||||
|
clockwork will run in a backgroud thread. As clockwork itself only performs scheduling, it will have
|
||||||
|
very little impact on performance
|
||||||
|
|
||||||
[1]: https://github.com/discourse/discourse/blob/master/docs/INSTALL-ubuntu.md
|
[1]: https://github.com/discourse/discourse/blob/master/docs/INSTALL-ubuntu.md
|
||||||
[2]: https://github.com/discourse/discourse/blob/master/docs/HEROKU.md
|
[2]: https://github.com/discourse/discourse/blob/master/docs/HEROKU.md
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user