mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-07-14 22:24:36 +08:00
新增:疑修操作记录、评论列表接口以及更新疑修无法产生操作记录修复
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user