nfo-resque-mongo 1.15.0 → 1.15.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/resque.rb CHANGED
@@ -212,7 +212,13 @@ module Resque
212
212
  start, count = [start, count].map { |n| Integer(n) }
213
213
  res = mongo.find(:queue => queue).sort([:date, 1]).skip(start).limit(count).to_a
214
214
  res.collect! { |doc| doc['item'] }
215
- count == 1 ? res.first : res
215
+ if count == 1
216
+ return nil if res.empty?
217
+ res.first
218
+ else
219
+ return [] if res.empty?
220
+ res
221
+ end
216
222
  end
217
223
 
218
224
  # Returns an array of all known Resque queues as strings,
@@ -56,9 +56,9 @@ module Resque
56
56
 
57
57
  # Will hold the last count - start results of
58
58
  # a search through all the failed jobs,
59
- # using the query string 'squery'
60
- def self.search_results(start = 0, count = 1, squery)
61
- backend.search_results(start, count, squery)
59
+ # using the query string 'query'
60
+ def self.search_results(query, start = 0, count = 1)
61
+ backend.search_results(query, start, count)
62
62
  end
63
63
 
64
64
  # The string url of the backend's web interface, if any.
@@ -7,7 +7,7 @@ module Resque
7
7
  class Mongo < Base
8
8
  def save
9
9
  data = {
10
- :failed_at => Time.now.utc,
10
+ :failed_at => Time.now.strftime("%Y/%m/%d %H:%M:%S"),
11
11
  :payload => payload,
12
12
  :exception => exception.class.to_s,
13
13
  :error => exception.to_s,
@@ -1,3 +1,3 @@
1
1
  module Resque
2
- Version = VERSION = '1.15.0'
2
+ Version = VERSION = '1.15.1'
3
3
  end
data/test/resque_test.rb CHANGED
@@ -181,7 +181,7 @@ context "Resque" do
181
181
  test "knows what queues it is managing" do
182
182
  assert_equal %w( people ), Resque.queues
183
183
  Resque.push(:cars, { 'make' => 'bmw' })
184
- assert_equal %w( cars people ), Resque.queues
184
+ assert_equal %w( cars people ), Resque.queues.sort
185
185
  end
186
186
 
187
187
  test "queues are always a list" do
@@ -191,7 +191,7 @@ context "Resque" do
191
191
 
192
192
  test "can delete a queue" do
193
193
  Resque.push(:cars, { 'make' => 'bmw' })
194
- assert_equal %w( cars people ), Resque.queues
194
+ assert_equal %w( cars people ), Resque.queues.sort
195
195
  Resque.remove_queue(:people)
196
196
  assert_equal %w( cars ), Resque.queues
197
197
  assert_equal nil, Resque.pop(:people)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: nfo-resque-mongo
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.15.0
5
+ version: 1.15.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Chris Wanstrath
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-03-23 00:00:00 +01:00
14
+ date: 2011-06-29 00:00:00 +02:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -25,50 +25,39 @@ dependencies:
25
25
  version: "1.0"
26
26
  type: :runtime
27
27
  version_requirements: *id001
28
- - !ruby/object:Gem::Dependency
29
- name: bson_ext
30
- prerelease: false
31
- requirement: &id002 !ruby/object:Gem::Requirement
32
- none: false
33
- requirements:
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: "1.0"
37
- type: :runtime
38
- version_requirements: *id002
39
28
  - !ruby/object:Gem::Dependency
40
29
  name: vegas
41
30
  prerelease: false
42
- requirement: &id003 !ruby/object:Gem::Requirement
31
+ requirement: &id002 !ruby/object:Gem::Requirement
43
32
  none: false
44
33
  requirements:
45
34
  - - ~>
46
35
  - !ruby/object:Gem::Version
47
36
  version: 0.1.2
48
37
  type: :runtime
49
- version_requirements: *id003
38
+ version_requirements: *id002
50
39
  - !ruby/object:Gem::Dependency
51
40
  name: sinatra
52
41
  prerelease: false
53
- requirement: &id004 !ruby/object:Gem::Requirement
42
+ requirement: &id003 !ruby/object:Gem::Requirement
54
43
  none: false
55
44
  requirements:
56
45
  - - ">="
57
46
  - !ruby/object:Gem::Version
58
47
  version: 0.9.2
59
48
  type: :runtime
60
- version_requirements: *id004
49
+ version_requirements: *id003
61
50
  - !ruby/object:Gem::Dependency
62
51
  name: json
63
52
  prerelease: false
64
- requirement: &id005 !ruby/object:Gem::Requirement
53
+ requirement: &id004 !ruby/object:Gem::Requirement
65
54
  none: false
66
55
  requirements:
67
56
  - - ~>
68
57
  - !ruby/object:Gem::Version
69
58
  version: 1.4.6
70
59
  type: :runtime
71
- version_requirements: *id005
60
+ version_requirements: *id004
72
61
  description: " Resque-mongo is a MongoDB-backed Ruby library for creating background jobs,\n placing those jobs on multiple queues, and processing them later.\n\n Background jobs can be any Ruby class or module that responds to\n perform. Your existing classes can easily be converted to background\n jobs or you can create new classes specifically to do work. Or, you\n can do both.\n\n Resque is heavily inspired by DelayedJob (which rocks) and is\n comprised of three parts:\n\n * A Ruby library for creating, querying, and processing jobs\n * A Rake task for starting a worker which processes jobs\n * A Sinatra app for monitoring queues, jobs, and workers.\n"
73
62
  email: chris@ozmm.org
74
63
  executables:
@@ -158,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
147
  requirements: []
159
148
 
160
149
  rubyforge_project:
161
- rubygems_version: 1.6.1
150
+ rubygems_version: 1.6.2
162
151
  signing_key:
163
152
  specification_version: 3
164
153
  summary: Resque is a Redis-backed queueing system.