From b5e0a6804dd0d4d29a5994f39ac7bbcd08ce2a3d Mon Sep 17 00:00:00 2001 From: Nick LaMuro Date: Mon, 13 Jan 2020 18:18:03 -0600 Subject: [PATCH] [WIP] Add TravisBranchMonitor Worker that is in charge of monitoring Travis for build_failures, and will create BuildFailure records and send messages to gitter as needed. --- app/workers/travis_branch_monitor.rb | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 app/workers/travis_branch_monitor.rb diff --git a/app/workers/travis_branch_monitor.rb b/app/workers/travis_branch_monitor.rb new file mode 100644 index 00000000..70c09ed6 --- /dev/null +++ b/app/workers/travis_branch_monitor.rb @@ -0,0 +1,29 @@ +require 'travis' + +class TravisBranchMonitor + include Sidekiq::Worker + sidekiq_options :queue => :miq_bot_glacial, :retry => false + + include Sidetiq::Schedulable + recurrence { hourly.minute_of_hour(0, 15, 30, 45) } + + include SidekiqWorkerMixin + + def perform + if !first_unique_worker? + logger.info("#{self.class} is already running, skipping") + else + process_repos + end + end + + def process_repos + enabled_repos.each { |repo| process_repo(repo) } + end + + def process_repo(repo) + end + + def process_branch(branch) + end +end