Merge remote-tracking branch 'origin/standalone_develop' into standalone_develop

This commit is contained in:
xxq250 2024-10-23 11:11:22 +08:00
commit d6ac38a9ce
2 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -19,4 +19,8 @@ class ProjectTopicRalate < ApplicationRecord
belongs_to :project_topic, counter_cache: :projects_count
belongs_to :project
validates :project_id, uniqueness: { scope: :project_topic_id }
end