Module: Postqueue
- Defined in:
- lib/postqueue.rb,
lib/postqueue/base.rb,
lib/postqueue/item.rb,
lib/postqueue/version.rb,
lib/postqueue/base/enqueue.rb,
lib/postqueue/base/processing.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
'0.0.11'- MAX_ATTEMPTS =
5
Class Method Summary collapse
- .logger ⇒ Object
- .migrate!(table_name = "postqueue") ⇒ Object
- .new ⇒ Object
- .unmigrate!(table_name = "postqueue") ⇒ Object
Class Method Details
.logger ⇒ Object
22 23 24 |
# File 'lib/postqueue/base.rb', line 22 def self.logger Logger.new(STDERR) end |
.migrate!(table_name = "postqueue") ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/postqueue/item.rb', line 14 def self.migrate!(table_name = "postqueue") Item.connection.execute " CREATE TABLE \#{table_name} (\n id SERIAL PRIMARY KEY, \n op VARCHAR,\n entity_type VARCHAR,\n entity_id INTEGER NOT NULL DEFAULT 0,\n created_at timestamp without time zone NOT NULL DEFAULT (now() at time zone 'utc'),\n next_run_at timestamp without time zone NOT NULL DEFAULT (now() at time zone 'utc'),\n failed_attempts INTEGER NOT NULL DEFAULT 0\n );\n\n CREATE INDEX \#{table_name}_idx1 ON \#{table_name}(entity_id);\n CREATE INDEX \#{table_name}_idx2 ON \#{table_name}(next_run_at);\n SQL\nend\n" |
.new ⇒ Object
26 27 28 |
# File 'lib/postqueue/base.rb', line 26 def self.new Base.new end |
.unmigrate!(table_name = "postqueue") ⇒ Object
8 9 10 11 12 |
# File 'lib/postqueue/item.rb', line 8 def self.unmigrate!(table_name = "postqueue") Item.connection.execute " DROP TABLE IF EXISTS \#{table_name};\n SQL\nend\n" |