Merge branch 'pre_trustie_server' into trustie_server

This commit is contained in:
yystopf 2024-06-27 09:16:01 +08:00
commit 8637dfb193
4 changed files with 7 additions and 4 deletions

View File

@ -10,7 +10,7 @@ class Admins::ProjectsRankController < Admins::BaseController
sum(issues) as issues, sum(issues) as issues,
sum(pullrequests) as pullrequests, sum(pullrequests) as pullrequests,
sum(commits) as commits").includes(:project) sum(commits) as commits").includes(:project)
@statistics = @statistics.order("#{sort_by} #{sort_direction}") @statistics = paginate @statistics.order("#{sort_by} #{sort_direction}")
export_excel(@statistics.limit(50)) export_excel(@statistics.limit(50))
end end

View File

@ -2,6 +2,7 @@ class CacheAsyncClearJob < ApplicationJob
queue_as :cache queue_as :cache
def perform(type, id=nil) def perform(type, id=nil)
return if id.nil?
case type case type
when "project_common_service" when "project_common_service"
Cache::V2::ProjectCommonService.new(id).clear Cache::V2::ProjectCommonService.new(id).clear

View File

@ -181,14 +181,14 @@ class Project < ApplicationRecord
end end
if changes[:is_public].present? if changes[:is_public].present?
if changes[:is_public][0] && !changes[:is_public][1] if changes[:is_public][0] && !changes[:is_public][1]
CacheAsyncClearJob.perform_later('project_rank_service', self.id) CacheAsyncClearJob.set(wait: 5.seconds).perform_later('project_rank_service', self.id)
end end
if !changes[:is_public][0] && changes[:is_public][1] if !changes[:is_public][0] && changes[:is_public][1]
$redis_cache.srem("v2-project-rank-deleted", self.id) $redis_cache.srem("v2-project-rank-deleted", self.id)
end end
end end
if !self.common? if !self.common?
CacheAsyncClearJob.perform_later('project_rank_service', self.id) CacheAsyncClearJob.set(wait: 5.seconds).perform_later('project_rank_service', self.id)
end end
end end

View File

@ -34,4 +34,6 @@
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<%= render partial: 'admins/shared/paginate', locals: { objects: statistics } %>