Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Disable redirect with max age = -1
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed Sep 22, 2020
1 parent 3e54e1d commit d37fc84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ By default, it will rely on the global setting ``kinto.http_host``.
When reaching the monitor/changes collection, if the provided ``_since`` query parameter
is too old, we redirect the clients to the full list of changes (ie. without ``_since``).

Set this setting to control the maximum age allowed:
Set this setting to control the maximum age allowed. Set to ``-1`` to disable redirection.

.. code-block :: ini
Expand Down
4 changes: 4 additions & 0 deletions kinto_changes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ def _handle_old_since_redirect(request):
"""
settings = request.registry.settings
max_age_since = int(settings.get("changes.since_max_age_days", 21))
if max_age_since < 0:
# Redirect is disabled.
return

min_since_dt = datetime.now() - timedelta(days=max_age_since)
min_since = min_since_dt.timestamp() * 1000

Expand Down

0 comments on commit d37fc84

Please sign in to comment.