2018-06-27 07:23:28 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 18:09:10 +00:00
|
|
|
class NewNoteWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 16:08:30 +00:00
|
|
|
include ApplicationWorker
|
2016-01-27 15:59:16 +00:00
|
|
|
|
2021-07-21 12:09:35 +00:00
|
|
|
data_consistency :always
|
|
|
|
|
2021-04-30 18:10:09 +00:00
|
|
|
sidekiq_options retry: 3
|
|
|
|
|
2021-10-27 15:13:41 +00:00
|
|
|
feature_category :team_planning
|
2020-03-02 18:07:42 +00:00
|
|
|
urgency :high
|
2019-10-30 15:14:17 +00:00
|
|
|
worker_resource_boundary :cpu
|
2020-01-24 18:09:00 +00:00
|
|
|
weight 2
|
2019-10-18 11:11:44 +00:00
|
|
|
|
2016-11-19 18:18:44 +00:00
|
|
|
# Keep extra parameter to preserve backwards compatibility with
|
|
|
|
# old `NewNoteWorker` jobs (can remove later)
|
|
|
|
def perform(note_id, _params = {})
|
2021-11-10 15:13:21 +00:00
|
|
|
if note = Note.find_by_id(note_id)
|
2021-02-09 18:09:59 +00:00
|
|
|
NotificationService.new.new_note(note) unless note.skip_notification?
|
2016-10-13 15:26:44 +00:00
|
|
|
Notes::PostProcessService.new(note).execute
|
|
|
|
else
|
2020-05-21 21:08:31 +00:00
|
|
|
Gitlab::AppLogger.error("NewNoteWorker: couldn't find note with ID=#{note_id}, skipping job")
|
2016-10-13 15:26:44 +00:00
|
|
|
end
|
2016-01-27 15:59:16 +00:00
|
|
|
end
|
|
|
|
end
|