easy_q 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -135,7 +135,7 @@ EOF
135
135
  ActiveRecord::Base.logger = @logger
136
136
  ActiveRecord::Base.colorize_logging = false
137
137
 
138
- ActiveRecord::Base.establish_connection(@settings)
138
+ ActiveRecord::Base.establish_connection(@settings[:database])
139
139
 
140
140
  ActiveRecord::Migrator.migrate("#{File.dirname(__FILE__)}/../../db/", nil)
141
141
  end
@@ -60,6 +60,17 @@ module EasyQ
60
60
  return nil
61
61
  end
62
62
 
63
+ def flush(queue_name = nil)
64
+
65
+ if queue_name.nil?
66
+ Message.delete_all ["(created_at + ttl) < ?)", queue_name, Time.now]
67
+ else
68
+ Message.delete_all ["(queue = ? and (created_at + ttl) < ?)", queue_name, Time.now]
69
+ end
70
+
71
+ return nil
72
+ end
73
+
63
74
  def push(options={})
64
75
  raise Exception, "missing options[:queue]" if !options.key?(:queue)
65
76
  raise Exception, "missing options[:body]" if !options.key?(:body)
@@ -1,7 +1,7 @@
1
1
  module EasyQ #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 6
4
+ MINOR = 7
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: easy_q
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.6.0
7
- date: 2007-02-28 00:00:00 -05:00
6
+ version: 0.7.0
7
+ date: 2007-03-01 00:00:00 -05:00
8
8
  summary: a simple little message queue
9
9
  require_paths:
10
10
  - lib