Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #3653 - Freshdesk import fails with timeout error.
- Loading branch information
Showing
4 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/ | ||
|
||
# Workaround for ActiveJob not supporting per-job timeouts with delayed_job. | ||
# | ||
# delayed_job does support this (https://github.com/collectiveidea/delayed_job#custom-jobs), | ||
# but since ActiveJob's adapter places a JobWrapper class around the jobs, it fails to work. | ||
# | ||
# Solve this by delegating that method to the actual job class instead. | ||
|
||
# Set the maximum possible max_run_time for any job to a high value, and set a sensible default | ||
# in ApplicationJob.max_run_time. Then specific jobs like AsyncImportJob can override this with a | ||
# higher value. | ||
Delayed::Worker.max_run_time = 7.days | ||
|
||
module ActiveJob | ||
module QueueAdapters | ||
class DelayedJobAdapter | ||
class JobWrapper | ||
def max_run_time | ||
job_data['job_class'].constantize.max_run_time | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters