新增:疑修操作记录、评论列表接口以及更新疑修无法产生操作记录修复

This commit is contained in:
2023-02-17 16:11:39 +08:00
parent 2a8e0d2be8
commit b85913e485
17 changed files with 448 additions and 141 deletions
+2 -10
View File
@@ -13,7 +13,7 @@ class Api::V1::Issues::DeleteService < ApplicationService
def call
raise Error, errors.full_messages.join(", ") unless valid?
try_lock # 开始写数据,加锁
try_lock("Api::V1::Issues::DeleteService:#{project.id}") # 开始写数据,加锁
delete_issue
@@ -23,7 +23,7 @@ class Api::V1::Issues::DeleteService < ApplicationService
SendTemplateMessageJob.perform_later('IssueDeleted', current_user.id, @issue&.subject, @issue.assigners.pluck(:id), @issue.author_id)
end
unlock
unlock("Api::V1::Issues::DeleteService:#{project.id}")
return true
end
@@ -34,12 +34,4 @@ class Api::V1::Issues::DeleteService < ApplicationService
raise Error, "删除疑修失败!" unless issue.destroy!
end
def try_lock
raise Error, "请稍后再试!" unless $redis_cache.set("Api::V1::Issues::DeleteService:#{project.id}", 1, nx: true, ex: 60.seconds)
end
def unlock
$redis_cache.del("Api::V1::Issues::DeleteService:#{project.id}")
end
end