lib/kjess/client.rb in kjess-1.1.0 vs lib/kjess/client.rb in kjess-1.2.0
- old
+ new
@@ -63,11 +63,11 @@
# Raise Exception if there is a
def version
v = KJess::Request::Version.new
r = send_recv( v )
return r.version if Response::Version === r
- raise KJess::Error, "Unexpected Response from VERSION command"
+ raise KJess::ProtocolError, "Unexpected Response from VERSION command"
end
# Public: Add an item to the given queue
#
# queue_name - the queue to put an item on
@@ -96,11 +96,11 @@
def get( queue_name, opts = {} )
opts = opts.merge( :queue_name => queue_name )
g = KJess::Request::Get.new( opts )
if opts[:wait_for]
- wait_for_in_seconds = opts[:wait_for] / 1000
+ wait_for_in_seconds = Float(opts[:wait_for]) / 1000.0
else
wait_for_in_seconds = 0.1
end
connection.with_additional_read_timeout(wait_for_in_seconds) do
@@ -234,11 +234,11 @@
# where this is not available will raise ServerError.
#
# Returns a String.
def status( update_to = nil )
resp = send_recv( KJess::Request::Status.new( :update_to => update_to ) )
- raise KJess::Error, "Status command is not supported" if KJess::Response::ClientError === resp
+ raise KJess::ProtocolError, "Status command is not supported" if KJess::Response::ClientError === resp
return resp.message
end
# Public: Return stats about the Kestrel server, they will be cached
# according to the stats_cache_expiration initialization parameter
@@ -254,10 +254,10 @@
# good overview of all the most used stats for a Kestrel server.
#
# Returns a Hash
def stats!
stats = send_recv( KJess::Request::Stats.new )
- raise KJess::Error, "Problem receiving stats: #{stats.inspect}" unless KJess::Response::Stats === stats
+ raise KJess::ProtocolError, "Problem receiving stats: #{stats.inspect}" unless KJess::Response::Stats === stats
h = stats.data
dump_stats = send_recv( KJess::Request::DumpStats.new )
h['queues'] = Hash.new
if KJess::Response::DumpedStats === dump_stats then