Class: SolidQueue::Record
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- SolidQueue::Record
- Includes:
- DistinctValues
- Defined in:
- app/models/solid_queue/record.rb,
app/models/solid_queue/record/distinct_values.rb
Defined Under Namespace
Modules: DistinctValues
Class Method Summary collapse
- .non_blocking_lock ⇒ Object
- .supports_insert_conflict_target? ⇒ Boolean
-
.use_index(*indexes) ⇒ Object
Pass index hints to the query optimizer using SQL comment hints.
Class Method Details
.non_blocking_lock ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/models/solid_queue/record.rb', line 13 def non_blocking_lock if SolidQueue.use_skip_locked lock(Arel.sql("FOR UPDATE SKIP LOCKED")) else lock end end |
.supports_insert_conflict_target? ⇒ Boolean
21 22 23 24 25 |
# File 'app/models/solid_queue/record.rb', line 21 def supports_insert_conflict_target? connection_pool.with_connection do |connection| connection.supports_insert_conflict_target? end end |
.use_index(*indexes) ⇒ Object
Pass index hints to the query optimizer using SQL comment hints. Uses MySQL 8 optimizer hint query comments, which SQLite and PostgreSQL ignore.
30 31 32 |
# File 'app/models/solid_queue/record.rb', line 30 def use_index(*indexes) optimizer_hints "INDEX(#{quoted_table_name} #{indexes.join(', ')})" end |