Skip to content

Commit

Permalink
general: fix robots cache timeout
Browse files Browse the repository at this point in the history
Co-Authored-by: Peter Weber <[email protected]>
  • Loading branch information
rerowep committed Nov 11, 2024
1 parent 1fdc0fb commit 18ce22c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion rero_ils/modules/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def add_org_lib_doc(item, doc_pid="dummy"):
return item


@cached()
@cached(timeout=2 * 60 * 60, query_string=True) # 2 hour timeout
def get_doc_item_lofi_schemas():
"""Get document, item, local field schemas."""
# document schema
Expand Down
4 changes: 2 additions & 2 deletions rero_ils/modules/documents/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@


@api_blueprint.route("/cover/<isbn>")
@cached(timeout=300, query_string=True)
@cached(timeout=5 * 60, query_string=True) # 5 minutes timeout
def cover(isbn):
"""Document cover service."""
return jsonify(get_remote_cover(isbn))
Expand All @@ -51,7 +51,7 @@ def document_availability(pid):


@api_blueprint.route("/advanced-search-config")
@cached(timeout=300, query_string=True)
@cached(timeout=5 * 60, query_string=True) # 5 minutes timeout
@check_logged_as_librarian
def advanced_search_config():
"""Advanced search config."""
Expand Down
2 changes: 1 addition & 1 deletion rero_ils/modules/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

@api_blueprint.route("/permissions/<route_name>", methods=["GET"])
@api_blueprint.route("/permissions/<route_name>/<record_pid>", methods=["GET"])
@cached(timeout=10, query_string=True)
@cached(timeout=10, query_string=True) # 10 seconds timeout
@check_authentication
def permissions(route_name, record_pid=None):
"""HTTP GET request for record permissions.
Expand Down
4 changes: 2 additions & 2 deletions rero_ils/theme/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def error():


@blueprint.route("/robots.txt")
@cached()
def robots(timeout=60 * 60): # 1 hour timeout
@cached(timeout=60 * 60, query_string=True) # 1 hour timeout
def robots():
"""Robots.txt generate response."""
response = current_app.config["RERO_ILS_ROBOTS"]
response = Response(response=response, status=200, mimetype="text/plain")
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_cli_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def test_cli_validate_documents_items_lofi(app, loc_public_martigny):
file_name = join(dirname(__file__), "../data/documents_items_lofi.json")

res = runner.invoke(validate_documents_with_items_lofis_cli, [file_name, "-v"])
print(">>>>", res)
assert res.output.strip().split("\n")[1:] == [
"1 document: dummy_1 errors: 1",
" documents: 'type' is a required property",
Expand Down

0 comments on commit 18ce22c

Please sign in to comment.