Can't gem install Celluloid using Rubinius 2.0.0
I figured it out thanks to this link https://gist.github.com/4123305
I needed to pass the -X19 flag
ruby -X19 -S bundle
Bundler installing seemingly un-needed gems
You can get Bundler to show you a full dependency graph:
sudo apt-get install graphviz
# Or however you install graphviz on your platform; http://www.graphviz.org/
gem install ruby-graphviz
bundle viz
You'll have a .png in the current directory with the full dependency graph.
Or, you can trace dependencies back by looking at your Gemfile.lock
file. In the GEM
section, each gem appears with its immediate dependencies indented beneath it, so you can trace back to the gem that you've asked for:
GEM
# ...
listen (2.4.0)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
# ...
guard (2.2.5)
formatador (>= 0.2.4)
listen (~> 2.1)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
# ...
Judging by your Gemfile, I'd guess that Celluloid is being included as a transitive dependency of guard-rails-assets
.
Celluloid 0.17.3 giving unexpected undefined method error
The undefined method
error occurred because actor methods are not called with a bang in the recent versions of celluloid gem. Instead you call the method like this: n.async.assholify
. So here is what the code should look like:
names = ['John', 'Tom', 'Harry']
names.each do |name|
n = SomeClass.new name
n.async.assholify # Instead of "n.assholify!"
end
For
"Celluloid 0.17.0 is running in BACKPORTED mode"
warning, take a look at this wiki. Backported Mode is the default, for a limited time. If you use require 'celluloid/current'
instead of require 'celluloid'
, you should not see this warning. Why is the error `Celluloid::Condition signaled spuriously` caused in Celluloid?
And to answer your question exactly like your stated question, using a condition.
Within the scope of an actor:
class Nats
include Celluloid
def initialize
@condition = Celluloid::Condition.new
end
def start
Rails.logger.debug "Sending RPC request to #{subject}"
NATS.start uri: ENV['NATS_SERVER'] do
Rails.logger.debug "Connected to #{ENV['NATS_SERVER']}"
sid = NATS.request(subject,msg) do |response|
Rails.logger.debug "Assigning response"
@condition.signal response
NATS.stop
end
NATS.timeout(sid, 1) do
NATS.stop
@condition.signal ASYNC_ERROR
raise "One second timeout waiting for a NATS RPC reply from #{subject}"
end
end
end
def value
@condition.wait
end
end
nats = Nats.new
nats.async.start
result = nats.value
if result = ASYNC_ERROR
raise "Error in RPC call"
else
return result
end
This is even less tested, but ought to show you the basic approach if you aren't going to use a Future
like my other answer.
PubNub Ruby SDK: Celluloid::DeadActorError: attempted to call a dead actor: fetch_average
I've contacted PubNub support and it turned out that there is a bug in pubnub gem version 4.0.25, which concerns a new feature - telemetry. For the moment downgrade to 4.0.23 solves the problem (using Ruby 2.4.0).
Related Topics
Import SASS File from Database Instead of Filesystem
Zero-Length String Being Returned from String#Split
Aws Cognito User Authentication Missing Required Parameter Srp_A
Rails 4 Session.Id Occasionally Nil
Tcp Socket Communication Between Processes on Heroku Worker Dyno
Installing Rmagick Gem -- Can't Find Magickwand.H
Ruby Variable Name with Double Underscores
How to Use Functions Like Concat(), etc. in Arel
Set Locale Automatically in Ruby on Rails
What Is the Opposite of Ruby's Include
Errno::Eaccess: Permission Denied @ Dir_S_Mkdir
Ruby String Split with Terminal Strings Empty
Travis Ci: Fatal: Role Does Not Exist
Declaring an Integer Range with Step != 1 in Ruby
What Order Do Before Filters Occur In