Previously the page-based (numbered) paginator would always count the total_pages, even in API calls when it wasn't needed. This could be very slow in some cases. Refactor so that total_pages isn't calculated unless it's called. While we're at it, refactor to condense all the sequential vs. numbered pagination logic into one module. This incidentally fixes a couple more bugs: * "page=b0" returned all pages rather than nothing. * Bad parameters like "page=blaha123" and "page=a123blah" were accepted.
15 lines
429 B
Ruby
15 lines
429 B
Ruby
require 'delayed/plugin'
|
|
|
|
class DelayedJobTimeoutPlugin < ::Delayed::Plugin
|
|
callbacks do |lifecycle|
|
|
lifecycle.before(:execute) do |job|
|
|
Delayed::Job.connection.execute "set statement_timeout = 0"
|
|
end
|
|
end
|
|
end
|
|
|
|
Delayed::Worker.logger = Logger.new(STDOUT, level: :debug)
|
|
Delayed::Worker.default_queue_name = "default"
|
|
Delayed::Worker.destroy_failed_jobs = false
|
|
Delayed::Worker.plugins << DelayedJobTimeoutPlugin
|