Merge branch 'standalone_develop' into pre_trustie_server

This commit is contained in:
yystopf 2024-06-27 09:15:37 +08:00
commit 90d0c8a282
5 changed files with 8 additions and 5 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,7 +2,7 @@ class VersionReleasesController < ApplicationController
include ApplicationHelper include ApplicationHelper
before_action :load_repository before_action :load_repository
before_action :set_user before_action :set_user
before_action :require_login, except: [:index, :show] before_action :require_login, except: [:index, :show, :download]
before_action :check_release_authorize, except: [:index, :show, :download] before_action :check_release_authorize, except: [:index, :show, :download]
before_action :find_version , only: [:show, :edit, :update, :destroy] before_action :find_version , only: [:show, :edit, :update, :destroy]

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

@ -35,3 +35,5 @@
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<%= render partial: 'admins/shared/paginate', locals: { objects: statistics } %>