Merge remote-tracking branch 'origin/standalone_develop' into standalone_develop
This commit is contained in:
commit
d6ac38a9ce
|
@ -4,6 +4,7 @@ class UpdateProjectTopicJob < ApplicationJob
|
||||||
queue_as :message
|
queue_as :message
|
||||||
|
|
||||||
def perform(project_id)
|
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)
|
project = Project.find_by(id: project_id)
|
||||||
return if project.blank?
|
return if project.blank?
|
||||||
begin
|
begin
|
||||||
|
@ -25,7 +26,9 @@ class UpdateProjectTopicJob < ApplicationJob
|
||||||
topic_count +=1
|
topic_count +=1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
$redis_cache.del("UpdateProjectTopicJob:#{project_id}")
|
||||||
rescue => e
|
rescue => e
|
||||||
|
$redis_cache.del("UpdateProjectTopicJob:#{project_id}")
|
||||||
puts "get_repos_languages: error:#{e.message}"
|
puts "get_repos_languages: error:#{e.message}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,4 +19,8 @@ class ProjectTopicRalate < ApplicationRecord
|
||||||
belongs_to :project_topic, counter_cache: :projects_count
|
belongs_to :project_topic, counter_cache: :projects_count
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
|
|
||||||
|
|
||||||
|
validates :project_id, uniqueness: { scope: :project_topic_id }
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue