Skip to content

Commit

Permalink
Merge pull request #85 from uktrade/feature/resolve-celery
Browse files Browse the repository at this point in the history
chore:set Celery timezone to Europe/London
  • Loading branch information
hareshkainthdbt authored Dec 6, 2024
2 parents eec607e + 6ec60f5 commit 1991203
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
7 changes: 0 additions & 7 deletions fbr/cache/manage_cache.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
# flake8: noqa
import os
import time

import django

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")

django.setup()

from fbr.cache.legislation import Legislation
from fbr.cache.public_gateway import PublicGateway
from fbr.search.config import SearchDocumentConfig
Expand Down
8 changes: 0 additions & 8 deletions fbr/config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,4 @@

USE_DEPRECATED_PYTZ = True

# REST_FRAMEWORK = {
# # Use Django's standard `django.contrib.auth` permissions,
# # or allow read-only access for unauthenticated users.
# 'DEFAULT_PERMISSION_CLASSES': [
# 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly',
# ]
# }

INSTALLED_APPS = BASE_APPS + INSTALLED_APPS # noqa
11 changes: 11 additions & 0 deletions fbr/cache/tasks.py → fbr/config/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@

@shared_task
def rebuild_cache():
"""
Rebuilds the cache for search documents across various components by
clearing all existing documents. The process is timed, and the
duration is included in the success response. If an exception occurs,
an error message is returned.
Returns:
dict: A dictionary containing either a success message with the
duration of the cache rebuilding process or an error message
detailing the exception that was raised.
"""
try:
start = time.time()
clear_all_documents()
Expand Down

0 comments on commit 1991203

Please sign in to comment.