From 2d8a3b36776e7786c60ca0a20067b3e8e613af70 Mon Sep 17 00:00:00 2001 From: Jan Baykara Date: Wed, 13 Mar 2024 07:26:17 +0000 Subject: [PATCH] Fix scheduling tasks --- hub/graphql/mutations.py | 5 +---- hub/tasks.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/hub/graphql/mutations.py b/hub/graphql/mutations.py index 180f11797..b90f46d40 100644 --- a/hub/graphql/mutations.py +++ b/hub/graphql/mutations.py @@ -68,10 +68,7 @@ def disable_auto_update (external_data_source_id: str) -> models.ExternalDataSou @strawberry.mutation(extensions=[IsAuthenticated()]) def trigger_update(external_data_source_id: str) -> models.ExternalDataSource: data_source = models.ExternalDataSource.objects.get(id=external_data_source_id) - # TODO: Return this to the queue - print("Triggering update") - async_to_sync(data_source.refresh_all)() - # job_id = data_source.schedule_refresh_all() + job_id = data_source.schedule_refresh_all() return data_source @strawberry.mutation(extensions=[IsAuthenticated()]) diff --git a/hub/tasks.py b/hub/tasks.py index 7cf1889f6..14c9a9565 100644 --- a/hub/tasks.py +++ b/hub/tasks.py @@ -23,7 +23,7 @@ async def refresh_all(external_data_source_id: str): # Refresh webhooks once a day @app.periodic(cron="0 3 * * *") @app.task(queue="index") -async def refresh_webhooks(external_data_source_id: str): +async def refresh_webhooks(external_data_source_id: str, timestamp): from hub.models import ExternalDataSource await ExternalDataSource.deferred_refresh_webhooks(external_data_source_id=external_data_source_id)