新增:创建数据延迟5秒触发webhook

This commit is contained in:
yystopf 2023-04-11 14:10:24 +08:00
parent bea2831149
commit 8663efc73b
2 changed files with 2 additions and 2 deletions

View File

@ -69,7 +69,7 @@ class Api::V1::Issues::CreateService < ApplicationService
end
# 触发webhook
TouchWebhookJob.perform_later('IssueCreate', @created_issue&.id, current_user.id)
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueCreate', @created_issue&.id, current_user.id)
TouchWebhookJob.perform_later('IssueLabel', @created_issue&.id, current_user.id, issue_tag_ids) unless issue_tag_ids.blank?
TouchWebhookJob.perform_later('IssueAssign', @created_issue&.id, current_user.id, assigner_ids) unless assigner_ids.blank?
unlock("Api::V1::Issues::CreateService:#{project.id}") # 结束写数据,解锁

View File

@ -41,7 +41,7 @@ class Api::V1::Issues::Journals::CreateService < ApplicationService
# @信息发送
AtmeService.call(current_user, @atme_receivers, @created_journal) unless receivers_login.blank?
TouchWebhookJob.perform_later('IssueComment', @issue&.id, @current_user.id, @created_journal.id, 'created', {})
TouchWebhookJob.set(wait: 5.seconds).perform_later('IssueComment', @issue&.id, @current_user.id, @created_journal.id, 'created', {})
unlock("Api::V1::Issues::Journals::CreateService:#{@issue.id}")
@created_journal