Skip to content

Commit

Permalink
Bump treatments default limit default to 1000 objects for queries tha…
Browse files Browse the repository at this point in the history
…t include other query parameters
  • Loading branch information
sulkaharo committed Sep 16, 2020
1 parent 8a1d6bf commit a0043ec
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/api/treatments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ function configure (app, wares, ctx, env) {
// List treatments available
api.get('/treatments', function(req, res) {
var query = req.query;
if (!query.count) { query.count = 100; }
if (!query.count) {
// If there's a date search involved, default to a higher number of objects
query.count = query.find ? 1000 : 100;
}

const inMemoryData = ctx.ddata.shadow.treatments;
const canServeFromMemory = inMemoryData && inMemoryData.length >= query.count && Object.keys(query).length == 1 ? true : false;
Expand Down

0 comments on commit a0043ec

Please sign in to comment.