Sha256: 7ff38f1151064e28b474340358fd7fe007010536b70bce26b685ef130373c92d
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
module Legion module Extensions module Tasker module Runners module TaskManager def purge_old(age: 31, limit: 100, status: 'task.completed', **_opts) log.debug("purging old completed tasks with an age > #{age} days, limit: #{limit}") dataset = Legion::Data::Model::Task .where(Sequel.lit("created <= DATE_SUB(SYSDATE(), INTERVAL #{age} DAY)")) .limit(limit) dataset.where(status: status) unless ['*', nil, ''].include? status log.debug "Deleting #{dataset.count} records" if dataset.count.positive? dataset&.delete end def expire_queued(age: 1, limit: 10, **) # rubocop:disable Lint/UnusedMethodArgument dataset = Legion::Data::Model::Task # rubocop:disable Lint/UselessAssignment .where(status: ['conditioner.queued', 'transformer.queued', 'task.queued']) .limit(limit) end include Legion::Extensions::Helpers::Task include Legion::Extensions::Helpers::Lex end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lex-tasker-0.2.1 | lib/legion/extensions/tasker/runners/task_manager.rb |
lex-tasker-0.2.0 | lib/legion/extensions/tasker/runners/task_manager.rb |