lib/resque.rb in resque-mongo-1.8.1 vs lib/resque.rb in resque-mongo-1.9.8.1

- old
+ new

@@ -34,12 +34,10 @@ @workers = @db.collection('workers') @failures = @db.collection('failures') @stats = @db.collection('stats') add_indexes - else - raise "I don't know what to do with #{server.inspect}" end end # Returns the current Redis connection. If none has been created, will @@ -99,12 +97,12 @@ def before_fork=(before_fork) @before_fork = before_fork end # The `after_fork` hook will be run in the child process and is passed - # the current job. Any changes you make, therefor, will only live as - # long as the job currently being processes. + # the current job. Any changes you make, therefore, will only live as + # long as the job currently being processed. # # Call with a block to set the hook. # Call with no arguments to return the hook. def after_fork(&block) block ? (@after_fork = block) : @after_fork @@ -124,14 +122,14 @@ @workers.create_index :worker @stats.create_index :stat end def drop - @mongo.drop - @workers.drop - @failures.drop - @stats.drop + @mongo.drop if @mongo + @workers.drop if @workers + @failures.drop if @failures + @stats.drop if @stats @mongo = nil end # # queue manipulation @@ -155,11 +153,11 @@ rescue Mongo::OperationFailure => e return nil if e.message =~ /No matching object/ raise e end - # Returns an int representing the size of a queue. + # Returns an integer representing the size of a queue. # Queue name should be a string. def size(queue) mongo.find(:queue => queue).count end @@ -303,10 +301,11 @@ :processed => Stat[:processed], :queues => queues.size, :workers => workers.size.to_i, :working => working.size, :failed => Stat[:failed], - :servers => ["#{@con.host}:#{@con.port}"] + :servers => ["#{@con.host}:#{@con.port}"], + :environment => ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development' } end # Returns an array of all known Resque keys in Redis. Redis' KEYS operation # is O(N) for the keyspace, so be careful - this can be slow for big databases.