From 3b8aedac6b977a210b2061acc27cbb029828e056 Mon Sep 17 00:00:00 2001 From: Javier Romero Castro Date: Wed, 17 May 2023 17:02:10 +0200 Subject: [PATCH] cronjobs: add daily clearing of identity cache * closes https://github.com/inveniosoftware/invenio-app-rdm/issues/2186 --- invenio_app_rdm/config.py | 6 ++++++ invenio_app_rdm/tasks.py | 1 + 2 files changed, 7 insertions(+) diff --git a/invenio_app_rdm/config.py b/invenio_app_rdm/config.py index 5516c60220..56d8c60feb 100644 --- a/invenio_app_rdm/config.py +++ b/invenio_app_rdm/config.py @@ -341,6 +341,12 @@ def files_rest_permission_factory(obj, action): ) ], }, + # Invenio communities provides some caching that has the potential to be never removed, + # therefore, we need a cronjob to ensure that at least once per day we clear the cache + "clear-cache": { + "task": "invenio_communities.tasks.clear_cache", + "schedule": timedelta(seconds=10), + }, } """Scheduled tasks configuration (aka cronjobs).""" diff --git a/invenio_app_rdm/tasks.py b/invenio_app_rdm/tasks.py index 9ddf2b37d5..3464d99049 100644 --- a/invenio_app_rdm/tasks.py +++ b/invenio_app_rdm/tasks.py @@ -8,6 +8,7 @@ import sqlalchemy as sa from celery import shared_task +from invenio_cache import current_cache from invenio_db import db from invenio_files_rest.models import FileInstance