Skip to content

Commit

Permalink
Rename GarbageCollectionEvent.created to timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandenburgh committed Dec 4, 2024
1 parent 93b64c0 commit 32dcaf1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions dandiapi/api/migrations/0013_garbagecollectionevent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.1.13 on 2024-11-25 20:12
# Generated by Django 4.1.13 on 2024-12-04 19:51
from __future__ import annotations

from django.db import migrations, models
Expand All @@ -19,7 +19,7 @@ class Migration(migrations.Migration):
auto_created=True, primary_key=True, serialize=False, verbose_name='ID'
),
),
('created', models.DateTimeField(auto_now_add=True)),
('timestamp', models.DateTimeField(auto_now_add=True)),
(
'type',
models.CharField(
Expand All @@ -38,8 +38,8 @@ class Migration(migrations.Migration):
'garbage_collection_event_id',
models.UUIDField(
editable=False,
help_text='Unique identifier for the garbage collection event.'
' Used to associate multiple records that are part of the same GC event.',
help_text='Unique identifier for the garbage collection event. Used to '
'associate multiple records that are part of the same GC event.',
),
),
],
Expand Down
2 changes: 1 addition & 1 deletion dandiapi/api/models/garbage_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


class GarbageCollectionEvent(models.Model):
created = models.DateTimeField(auto_now_add=True)
timestamp = models.DateTimeField(auto_now_add=True)
type = models.CharField(
max_length=255, help_text='The model name of the records that were garbage collected.'
)
Expand Down
2 changes: 1 addition & 1 deletion dandiapi/api/services/garbage_collection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def garbage_collect():
garbage_collected_asset_blobs = _garbage_collect_asset_blobs()

GarbageCollectionEvent.objects.filter(
created__lt=timezone.now() - RESTORATION_WINDOW
timestamp__lt=timezone.now() - RESTORATION_WINDOW
).delete()

logger.info('Garbage collected %s Uploads.', garbage_collected_uploads)
Expand Down

0 comments on commit 32dcaf1

Please sign in to comment.