Skip to content

Commit

Permalink
Fix scheduling tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
janbaykara committed Mar 13, 2024
1 parent 21f859d commit 2d8a3b3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions hub/graphql/mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()])
Expand Down
2 changes: 1 addition & 1 deletion hub/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 2d8a3b3

Please sign in to comment.