Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions src/sentry/runner/commands/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def is_filtered(model):
# Deletions that use `BulkDeleteQuery` (and don't need to worry about child relations)
# (model, datetime_field, order_by)
BULK_QUERY_DELETES = [
(models.EventMapping, 'date_added', '-date_added'),
(models.GroupEmailThread, 'date', None),
(models.GroupRuleStatus, 'date_added', None),
] + EXTRA_BULK_QUERY_DELETES
Expand Down Expand Up @@ -321,22 +322,6 @@ def is_filtered(model):
days, project_id, model, dtfield, order_by)
_chunk_until_complete(task)

# EventMapping is fairly expensive and is special cased as it's likely you
# won't need a reference to an event for nearly as long
if not silent:
click.echo("Removing expired values for EventMapping")
if is_filtered(models.EventMapping):
if not silent:
click.echo('>> Skipping EventMapping')
else:
BulkDeleteQuery(
model=models.EventMapping,
dtfield='date_added',
days=min(days, 7),
project_id=project_id,
order_by='-date_added'
).execute()

# Clean up FileBlob instances which are no longer used and aren't super
# recent (as there could be a race between blob creation and reference)
if not silent:
Expand Down