Skip to content

Commit

Permalink
Merge pull request #9406 from adrianschroeter/speed_up_request_creation
Browse files Browse the repository at this point in the history
[frontend] speed up request creation
  • Loading branch information
hennevogel committed Aug 13, 2020
2 parents 0914a07 + e88af6f commit efe068f
Show file tree
Hide file tree
Showing 67 changed files with 2,175 additions and 16,352 deletions.
2 changes: 1 addition & 1 deletion src/api/app/lib/backend/api/sources/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def self.write_link(project_name, package_name, user_login, content)
# @option options [String] :filelimit Sets the maximum lines of the diff which will be returned (0 = all lines)
# @return [String]
def self.source_diff(project_name, package_name, options = {})
accepted = [:rev, :orev, :opackage, :oproject, :linkrev, :olinkrev, :expand, :filelimit, :tarlimit, :withissues, :view, :cacheonly]
accepted = [:rev, :orev, :opackage, :oproject, :linkrev, :olinkrev, :expand, :filelimit, :tarlimit, :withissues, :view, :cacheonly, :nodiff]
diff = http_post(['/source/:project/:package', project_name, package_name], defaults: { cmd: :diff }, params: options, accepted: accepted)
diff.valid_encoding? ? diff : diff.encode('UTF-8', 'binary', invalid: :replace, undef: :replace)
end
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/bs_request_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def notify_params(ret = {})
end

def contains_change?
return sourcediff.present?
return sourcediff(nodiff: 1).present?
rescue BsRequestAction::Errors::DiffError
# if the diff can'be created we can't say
# but let's assume the reason for the problem lies in the change
Expand Down
10 changes: 8 additions & 2 deletions src/api/app/models/bs_request_action/differ/for_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module Differ
class ForSource
include ActiveModel::Model

# FIXME: this default either must be changed in backend
# or it should only be used for specific views
DEFAULT_FILE_LIMIT = 10_000

attr_accessor :bs_request_action, :source_package_names
Expand Down Expand Up @@ -44,8 +46,12 @@ def query
query = {}
query[:view] = :xml if options[:view].to_s == 'xml'
query[:withissues] = 1 if options[:withissues].present?
query[:filelimit] = options[:filelimit] ? options[:filelimit].to_i : DEFAULT_FILE_LIMIT
query[:tarlimit] = options[:tarlimit] ? options[:tarlimit].to_i : DEFAULT_FILE_LIMIT
if options[:nodiff].present?
query[:nodiff] = 1
else
query[:filelimit] = options[:filelimit] ? options[:filelimit].to_i : DEFAULT_FILE_LIMIT
query[:tarlimit] = options[:tarlimit] ? options[:tarlimit].to_i : DEFAULT_FILE_LIMIT
end
query
end

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit efe068f

Please sign in to comment.