Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git@github.com:railsrumble/gobrain
- Loading branch information
Showing
4 changed files
with
79 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Checker < Workling::Base | ||
def wait(options) | ||
sleep 10 | ||
place = Place.find options[:place_id] | ||
|
||
logger.error place.user.id, place.room.permalink | ||
|
||
if !Juggernaut.client_in_channel?(place.user.id, place.room.permalink) and place.connections > 0 | ||
place.decrement! :connections | ||
|
||
data = { :command => 'disconnect', :user => place.user.id } | ||
json = data.inject({}) {|escaped_data,(k,v)| escaped_data.merge k => JuggernautJSON::Helper.h(v) }.to_json | ||
|
||
Juggernaut.send_to_channel json, place.room.permalink | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
=> Loading Rails... | ||
** Rails loaded. | ||
** Starting Workling::Starling::Poller... | ||
** Use CTRL-C to stop. | ||
** Exiting | ||
/Users/brainopia/code/rails/gobrain/vendor/plugins/workling/lib/workling/starling/client.rb:47:in `raise_unless_connected!': config/starling.yml configured to connect to starling on localhost:22122 for this environment. could not connect to starling on this host:port. pass starling the port with -p flag when starting it. If you don't want to use Starling at all, then explicitly set Workling::Remote.dispatcher (see README for an example) (Workling::StarlingNotFoundError) | ||
from /Users/brainopia/code/rails/gobrain/vendor/plugins/workling/script/../lib/workling/starling/poller.rb:42:in `join' | ||
from /Users/brainopia/code/rails/gobrain/vendor/plugins/workling/script/../lib/workling/starling/poller.rb:42:in `listen' | ||
from /Users/brainopia/code/rails/gobrain/vendor/plugins/workling/script/../lib/workling/starling/poller.rb:42:in `each' | ||
from /Users/brainopia/code/rails/gobrain/vendor/plugins/workling/script/../lib/workling/starling/poller.rb:42:in `listen' | ||
from /Users/brainopia/code/rails/gobrain/vendor/plugins/workling/script/listen.rb:19 | ||
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:176:in `load' | ||
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:176:in `start_load' | ||
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:257:in `start' | ||
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/controller.rb:69:in `run' | ||
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons.rb:139:in `run' | ||
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `call' | ||
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `catch_exceptions' | ||
from /opt/local/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons.rb:138:in `run' | ||
from script/workling_starling_client:17 | ||
=> Loading Rails... | ||
** Rails loaded. | ||
** Starting Workling::Starling::Poller... | ||
** Use CTRL-C to stop. | ||
** Exiting | ||
=> Loading Rails... | ||
** Rails loaded. | ||
** Starting Workling::Starling::Poller... | ||
** Use CTRL-C to stop. | ||
** Exiting | ||
=> Loading Rails... | ||
** Rails loaded. | ||
** Starting Workling::Starling::Poller... | ||
** Use CTRL-C to stop. | ||
** Exiting | ||
=> Loading Rails... | ||
** Rails loaded. | ||
** Starting Workling::Starling::Poller... | ||
** Use CTRL-C to stop. | ||
** Exiting | ||
=> Loading Rails... | ||
** Rails loaded. | ||
** Starting Workling::Starling::Poller... | ||
** Use CTRL-C to stop. | ||
** Exiting | ||
=> Loading Rails... | ||
** Rails loaded. | ||
** Starting Workling::Starling::Poller... | ||
** Use CTRL-C to stop. | ||
** Exiting | ||
=> Loading Rails... | ||
** Rails loaded. | ||
** Starting Workling::Starling::Poller... | ||
** Use CTRL-C to stop. | ||
** Exiting | ||
=> Loading Rails... | ||
** Rails loaded. | ||
** Starting Workling::Starling::Poller... | ||
** Use CTRL-C to stop. | ||
** Exiting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1 @@ | ||
require 'pp' | ||
|
||
puts '=> Loading Rails...' | ||
|
||
require File.dirname(__FILE__) + '/../config/environment' | ||
require File.dirname(__FILE__) + '/../vendor/plugins/workling/lib/workling/starling/poller' | ||
require File.dirname(__FILE__) + '/../vendor/plugins/workling/lib/workling/starling/routing/class_and_method_routing' | ||
|
||
puts '** Rails loaded.' | ||
|
||
trap(:INT) { exit } | ||
|
||
begin | ||
client = Workling::Starling::Client.new | ||
client.reset | ||
|
||
client.stats # do this so that connection is shown as established below. | ||
|
||
puts "Queue state:" | ||
pp client.inspect | ||
pp "Active?: #{client.active?}" | ||
pp "Read Only?: #{client.readonly?}" | ||
puts "" | ||
puts "Servers:" | ||
pp client.servers | ||
puts "" | ||
puts "Queue stats:" | ||
pp client.stats | ||
|
||
puts "\nThread Stats:" | ||
pp Thread.list | ||
ensure | ||
puts '** Exiting' | ||
end | ||
1173 |