Skip to content

Commit

Permalink
Fix max-age issues on textless endpoint (#3477)
Browse files Browse the repository at this point in the history
* max_age should default to -1

* pass maxAge along to `execute`
  • Loading branch information
Omer Lachish authored Feb 21, 2019
1 parent 4ad303b commit 2a37cb3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/app/services/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ function QueryResource(
};

QueryService.prototype.getQueryResult = function getQueryResult(maxAge) {
const execute = () => QueryResult.getByQueryId(this.id, this.getParameters().getValues());
const execute = () => QueryResult.getByQueryId(this.id, this.getParameters().getValues(), maxAge);
return this.prepareQueryResultExecution(execute, maxAge);
};

Expand Down
6 changes: 5 additions & 1 deletion redash/handlers/query_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@ def post(self, query_id):
"""
params = request.get_json(force=True)
parameters = params.get('parameters', {})
max_age = int(params.get('max_age', 0))
max_age = params.get('max_age', -1)
# max_age might have the value of None, in which case calling int(None) will fail
if max_age is None:
max_age = -1
max_age = int(max_age)

query = get_object_or_404(models.Query.get_by_id_and_org, query_id, self.current_org)
parameter_schema = query.options.get("parameters", [])
Expand Down

0 comments on commit 2a37cb3

Please sign in to comment.