huginn/bin/twitter_stream.rb
Dominik Sander 8a51dbc4bd Provide an optional threaded background worker
Due to the three background workers (scheduler, twitter stream and delayed job)
huginn needs a lot of memory to run (about 520MB on my dev machine). This PR
introduces an optional threaded background worker which combines the three current
separated processed into one (reducing the memory footprint to ~260MB).
Since just one instance of the of every background processor is running at a time
there should not be any threading related issues.
The main gotcha of this is, that it's most likely not possible to run multiple
delayed job workers concurrently. The ultimate solution would probably be switching
to sidekiq with sidetiq as scheduler, but that is a different task :)

When running on MRI the GIL should not be an issue because it is released for most IO
bound operations (waiting for the database/website/sleeping).
2014-05-12 00:28:07 +02:00

15 lines
No EOL
484 B
Ruby
Executable file

#!/usr/bin/env ruby
# This process is used by TwitterStreamAgents to watch the Twitter stream in real time. It periodically checks for
# new or changed TwitterStreamAgents and starts to follow the stream for them. It is typically run by foreman via
# the included Procfile.
unless defined?(Rails)
puts
puts "Please run me with rails runner, for example:"
puts " RAILS_ENV=production bundle exec rails runner bin/twitter_stream.rb"
puts
exit 1
end
TwitterStream.new.run