Skip to content

Commit

Permalink
[Fixes GeoNode#10303] automatic periodic TaskResult removal (GeoNode#…
Browse files Browse the repository at this point in the history
…10306) (GeoNode#10319)

* [Fixes GeoNode#10303] automatic periodic TaskResult removal

* [Fixes GeoNode#10303] automatic periodic TaskResult removal

* [Fixes GeoNode#10303] automatic periodic TaskResult removal

* [Fixes GeoNode#10303] fix flake8 formatting

Co-authored-by: Alessio Fabiani <[email protected]>

Co-authored-by: mattiagiupponi <[email protected]>
Co-authored-by: Alessio Fabiani <[email protected]>
  • Loading branch information
3 people authored and ridoo committed Feb 22, 2024
1 parent da00b9c commit c00385f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions geonode/upload/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ def run_setup_hooks(sender, **kwargs):
start_time=timezone.now(),
),
)
daily_interval, _ = IntervalSchedule.objects.get_or_create(
every=1,
period="days"
)
PeriodicTask.objects.update_or_create(
name="clean-up-old-task-result",
defaults=dict(
task="geonode.upload.tasks.cleanup_celery_task_entries",
interval=daily_interval,
args='',
start_time=timezone.now()
)
)


class UploadAppConfig(AppConfig):
Expand All @@ -60,6 +73,10 @@ def ready(self):
"task": "geonode.upload.tasks.cleanup_celery_task_entries",
"schedule": 86400.0,
}
settings.CELERY_BEAT_SCHEDULE['clean-up-old-task-result'] = {
'task': 'geonode.upload.tasks.cleanup_celery_task_entries',
'schedule': 86400.0,
}


default_app_config = "geonode.upload.UploadAppConfig"

0 comments on commit c00385f

Please sign in to comment.