Browse Source

Maintenance: Removed some leftovers of legacy Scheduler.

Martin Gruner 2 years ago
parent
commit
b8adb613d1

+ 2 - 2
app/assets/javascripts/app/views/layout_ref/scheduler_modal.jst.eco

@@ -351,8 +351,8 @@
             Nicole Braun (Zammad Foundation)
           </span> </td>
         <td>
-          <a href="#ticket/zoom/6"> <span title="script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler">
-              script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler
+          <a href="#ticket/zoom/6"> <span title="script/background-worker.rb start">
+              script/background-worker.rb start
             </span> </a>
         </td>
         <td> <span>

+ 7 - 7
app/assets/javascripts/app/views/layout_ref/sla_modal.jst.eco

@@ -59,7 +59,7 @@
 </div>
 <div class="filter-preview">
   <h3>
-    Preview 
+    Preview
     <span class="subtitle hide">
       <span class="u-highlight">5</span> matches
     </span>
@@ -160,8 +160,8 @@
             Nicole Braun (Zammad Foundation)
           </span> </td>
         <td>
-          <a href="#ticket/zoom/6"> <span title="script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler">
-              script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler.rb start script/scheduler
+          <a href="#ticket/zoom/6"> <span title="script/background-worker.rb start">
+              script/background-worker.rb start
             </span> </a>
         </td>
         <td> <span>
@@ -177,8 +177,8 @@
 
 <h2>Schedule</h2>
 <h3>
-  Business Hours 
-  <div class="subtitle">in <span class="js-timezone">European Central Time</span> 
+  Business Hours
+  <div class="subtitle">in <span class="js-timezone">European Central Time</span>
     (<div class="btn btn--text btn--secondary btn--dropdown">
       change
       <select class="form-control js-selectTimezone" name="timezone">
@@ -804,7 +804,7 @@
       <%- @Icon('radio-checked', 'icon-checked') %>
     </span>
 
-  Subscribe to public holidays in 
+  Subscribe to public holidays in
 
   </label>
   <div class="u-inlineBlock u-positionOrigin">
@@ -824,7 +824,7 @@
       <%- @Icon('radio-checked', 'icon-checked') %>
     </span>
 
-    Subscribe to ical feed 
+    Subscribe to ical feed
 
   </label>
   <input class="form-control form-control--small form-control--inline" type="url">

+ 4 - 4
app/models/import_job.rb

@@ -38,13 +38,13 @@ class ImportJob < ApplicationModel
     save
   end
 
-  # Gets called when the Scheduler gets (re-)started and this job was still
+  # Gets called when the background worker gets (re-)started and this job was still
   # in the queue. If `finished_at` is blank the call is piped through to
   # the ImportJob backend which has to decide how to go from here. The delayed
   # job will get destroyed if rescheduled? is not implemented
   # as an ImportJob backend class method.
   #
-  # @see Scheduler#cleanup_delayed
+  # @see BackgroundServices::Service::ProcessDelayedJobs::CleanupAction.cleanup_delayed_jobs
   #
   # @example
   #  import.reschedule?(delayed_job)
@@ -168,12 +168,12 @@ class ImportJob < ApplicationModel
   # @param [ActiveSupport::TimeWithZone] after the time the cleanup was started
   #
   # @example
-  #   Scheduler.cleanup_import_jobs(TimeZone.now)
+  #   ImportJob.cleanup_import_jobs(TimeZone.now)
   #
   # return [nil]
   def self.cleanup_import_jobs(after)
     log_start_finish(:info, "Cleanup of left over import jobs #{after}") do
-      error = __('Interrupted by scheduler restart. Please restart manually or wait until the next execution time.').freeze
+      error = __('Interrupted by a restart of the background worker process. Please restart manually or wait until the next execution time.').freeze
 
       # we need to exclude jobs that were updated at or since we started
       # cleaning up (via the #reschedule? call) because they might

+ 3 - 3
config/spring.rb

@@ -9,14 +9,14 @@ Spring.watch(
 
 module Spring
   module Commands
-    class SchedulerRb
+    class BackgroundWorkerRb
 
       def call
-        load ::Rails.root.join('script/scheduler.rb')
+        load ::Rails.root.join('script/background-worker.rb')
       end
     end
 
-    Spring.register_command 'scheduler.rb', Spring::Commands::SchedulerRb.new
+    Spring.register_command 'background-worker.rb', Spring::Commands::BackgroundWorkerRb.new
   end
 end
 

+ 1 - 1
i18n/zammad.pot

@@ -5220,7 +5220,7 @@ msgid "Internal"
 msgstr ""
 
 #: app/models/import_job.rb
-msgid "Interrupted by scheduler restart. Please restart manually or wait until the next execution time."
+msgid "Interrupted by a restart of the background worker process. Please restart manually or wait until the next execution time."
 msgstr ""
 
 #: app/controllers/first_steps_controller.rb

+ 1 - 1
lib/background_services/service/process_scheduled_jobs.rb

@@ -15,7 +15,7 @@ class BackgroundServices
 
       def launch
         loop do
-          Rails.logger.info 'Scheduler running...'
+          Rails.logger.info 'ProcessScheduledJobs running...'
 
           run_jobs
 

+ 2 - 2
lib/import/base.rb

@@ -14,7 +14,7 @@ module Import
       true
     end
 
-    # Checks if the backend is able to get queued by the Scheduler.
+    # Checks if the backend is able to get queued by the background worker.
     #
     # @example
     #  Import::ExampleBackend.queueable?
@@ -25,7 +25,7 @@ module Import
       true
     end
 
-    # Checks if the backend is able to get rescheduled in case the Scheduler
+    # Checks if the backend is able to get rescheduled in case the background worker
     # got (re-)started while this ImportJob was running. Defaults to false.
     #
     # @example

+ 3 - 3
lib/import/integration_base.rb

@@ -5,7 +5,7 @@ module Import
   # This base class handles regular integrations.
   # It provides generic interfaces for settings and active state.
   # It ensures that all requirements for a regular integration are met before a import can start.
-  # It handles the case of an Scheduler interruption.
+  # It handles the case of a background worker interruption.
   #
   # It's required to implement the +start_import+ method which only has to start the import.
   class IntegrationBase < Import::Base
@@ -101,9 +101,9 @@ module Import
       start_import
     end
 
-    # Gets called when the Scheduler gets (re-)started and an ImportJob was still
+    # Gets called when the background worker gets (re-)started and an ImportJob was still
     # in the queue. The job will always get restarted to avoid the gap till the next
-    # run triggered by the Scheduler. The result will get updated to inform the user
+    # run triggered by the background worker. The result will get updated to inform the user
     # in the agent interface result view.
     #
     # @example

+ 0 - 4
spec/lib/background_services/service/process_delayed_jobs/cleanup_action_spec.rb

@@ -66,10 +66,6 @@ RSpec.describe BackgroundServices::Service::ProcessDelayedJobs::CleanupAction do
       expect(instance).not_to have_received(:reschedulable?)
     end
 
-    # it 'reschedules an eligible job' do
-    # pending 'looks like dead code in pre-refactoring Scheduler'
-    # end
-
     it 'destroys non-reschedulable job' do
       SampleDelayedJob.perform_later
 

+ 1 - 3
spec/models/channel/driver/twitter_spec.rb

@@ -917,10 +917,8 @@ RSpec.describe Channel::Driver::Twitter, required_envs: %w[TWITTER_CONSUMER_KEY
                 let(:twitter_job) { Delayed::Job.where("handler LIKE '%job_class: CommunicateTwitterJob%#{tweet.id}%'").first }
 
                 around do |example|
-                  # Run BG job (Why not use Scheduler.worker?
-                  # It led to hangs & failures elsewhere in test suite.)
                   Thread.new do
-                    sleep 5 # simulate other bg jobs holding up the queue
+                    sleep 5 # Simulate other bg jobs holding up the queue.
                     twitter_job.invoke_job
                   end.tap { example.run }.join
                 end