lib/restful_model_collection.rb in inbox-0.14.0 vs lib/restful_model_collection.rb in inbox-0.14.1
- old
+ new
@@ -13,11 +13,11 @@
@_api = api
end
def each
offset = 0
- chunk_size = 1000
+ chunk_size = 100
finished = false
while (!finished) do
results = get_model_collection(offset, chunk_size)
results.each { |item|
yield item
@@ -47,14 +47,14 @@
collection.filters ||= {}
collection.filters.merge!(filters)
collection
end
- def range(offset = 0, limit = 1000)
+ def range(offset = 0, limit = 100)
accumulated = []
finished = false
- chunk_size = 1000
+ chunk_size = 100
while (!finished && accumulated.length < limit) do
results = get_model_collection(offset + accumulated.length, chunk_size)
accumulated = accumulated.concat(results)
@@ -121,10 +121,10 @@
end
}
model
end
- def get_model_collection(offset = 0, limit = 1000)
+ def get_model_collection(offset = 0, limit = 100)
filters = @filters.clone
filters[:offset] = offset
filters[:limit] = limit
models = []