Class: SolidQueue::Record
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- SolidQueue::Record
show all
- 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
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.
40
41
42
|
# File 'app/models/solid_queue/record.rb', line 40
def use_index(*indexes)
optimizer_hints "INDEX(#{quoted_table_name} #{indexes.join(', ')})"
end
|
.warn_about_pending_migrations ⇒ Object
27
28
29
30
31
32
33
34
35
|
# File 'app/models/solid_queue/record.rb', line 27
def warn_about_pending_migrations
SolidQueue.deprecator.warn(<<~DEPRECATION)
Solid Queue has pending database migrations. To get the new migration files, run:
rails solid_queue:update
And then:
rails db:migrate
These migrations will be required after version #{SolidQueue.next_major_version}.0
DEPRECATION
end
|