projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
3824: Create "all users" group in seeds.rb instead of asking a human to do it.
[arvados.git]
/
services
/
api
/
lib
/
load_param.rb
diff --git
a/services/api/lib/load_param.rb
b/services/api/lib/load_param.rb
index 8d5a9d21ee20d39bb9673d5e4671dfbdc97e3a2e..3f1a3b223a851f46c171a58d5b182a6790df12f1 100644
(file)
--- a/
services/api/lib/load_param.rb
+++ b/
services/api/lib/load_param.rb
@@
-6,9
+6,12
@@
# @where, @filters, @limit, @offset, @orders
module LoadParam
# @where, @filters, @limit, @offset, @orders
module LoadParam
- # Default
limit on
number of rows to return in a single query.
+ # Default number of rows to return in a single query.
DEFAULT_LIMIT = 100
DEFAULT_LIMIT = 100
+ # Maximum number of rows to return in a single query, even if the client asks for more.
+ MAX_LIMIT = 1000
+
# Load params[:where] into @where
def load_where_param
if params[:where].nil? or params[:where] == ""
# Load params[:where] into @where
def load_where_param
if params[:where].nil? or params[:where] == ""
@@
-55,7
+58,7
@@
module LoadParam
unless params[:limit].to_s.match(/^\d+$/)
raise ArgumentError.new("Invalid value for limit parameter")
end
unless params[:limit].to_s.match(/^\d+$/)
raise ArgumentError.new("Invalid value for limit parameter")
end
- @limit =
params[:limit].to_i
+ @limit =
[params[:limit].to_i, MAX_LIMIT].min
else
@limit = DEFAULT_LIMIT
end
else
@limit = DEFAULT_LIMIT
end