Skip to content

Commit

Permalink
Making redundant reading deletion more efficient with a smaller evalu…
Browse files Browse the repository at this point in the history
…ation window.
  • Loading branch information
audaciouscode committed Aug 1, 2016
1 parent 2b45303 commit 0ea9abb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion management/commands/delete_redundant_readings.py
Expand Up @@ -29,7 +29,9 @@ def add_arguments(self, parser):
def handle(self, *args, **options):
to_delete = []

matches = DataPoint.objects.order_by('source', 'generator_identifier', 'created').values('source', 'generator_identifier', 'created').annotate(Count('pk'))
start = timezone.now() - datetime.timedelta(hours=4)

matches = DataPoint.objects.filter(recorded__gte=start).order_by('source', 'generator_identifier', 'created').values('source', 'generator_identifier', 'created').annotate(Count('pk'))

dupes = []

Expand Down

0 comments on commit 0ea9abb

Please sign in to comment.