Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Put status job listener in prepare block

Oliver Günthere670a84d64b6
diff --git a/modules/job_status/lib/open_project/job_status/engine.rb b/modules/job_status/lib/open_project/job_status/engine.rb
index 7d09fb4a727..b89297da6bb 100644
--- a/modules/job_status/lib/open_project/job_status/engine.rb
+++ b/modules/job_status/lib/open_project/job_status/engine.rb
@@ -46,16 +46,14 @@ module OpenProject::JobStatus
"#{root}/job_statuses/#{uuid}"
end
- initializer 'job_status.event_listener' do
+ config.to_prepare do
+ # Register the cron job to clear statuses periodically
+ ::Cron::CronJob.register! ::JobStatus::Cron::ClearOldJobStatusJob
+
# Extends the ActiveJob adapter in use (DelayedJob) by a Status which lives
# indenpendently from the job itself (which is deleted once successful or after max attempts).
# That way, the result of a background job is available even after the original job is gone.
EventListener.register!
end
-
- config.to_prepare do
- # Register the cron job to clear statuses periodically
- ::Cron::CronJob.register! ::JobStatus::Cron::ClearOldJobStatusJob
- end
end
end