mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
新增:更新项目搜索标签加锁
This commit is contained in:
@@ -4,6 +4,7 @@ class UpdateProjectTopicJob < ApplicationJob
|
||||
queue_as :message
|
||||
|
||||
def perform(project_id)
|
||||
return unless $redis_cache.set("UpdateProjectTopicJob:#{project_id}", 1, nx: true, ex: 10.seconds)
|
||||
project = Project.find_by(id: project_id)
|
||||
return if project.blank?
|
||||
begin
|
||||
@@ -25,7 +26,9 @@ class UpdateProjectTopicJob < ApplicationJob
|
||||
topic_count +=1
|
||||
end
|
||||
end
|
||||
$redis_cache.del("UpdateProjectTopicJob:#{project_id}")
|
||||
rescue => e
|
||||
$redis_cache.del("UpdateProjectTopicJob:#{project_id}")
|
||||
puts "get_repos_languages: error:#{e.message}"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user