OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Profile reporting service.""" | 5 """Profile reporting service.""" |
6 | 6 |
7 import datetime | 7 import datetime |
8 import json | 8 import json |
9 import logging | 9 import logging |
10 | 10 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 """A cron job.""" | 110 """A cron job.""" |
111 @utils.requires_work_queue_login | 111 @utils.requires_work_queue_login |
112 def get(self): | 112 def get(self): |
113 """Delete reports older than ~6 months.""" | 113 """Delete reports older than ~6 months.""" |
114 cutoff = datetime.datetime.now() - datetime.timedelta(days=31*6) | 114 cutoff = datetime.datetime.now() - datetime.timedelta(days=31*6) |
115 # Will only delete 1000 reports at a time max. Shouldn't be a problem unless | 115 # Will only delete 1000 reports at a time max. Shouldn't be a problem unless |
116 # we get more than 1000 reports/day. | 116 # we get more than 1000 reports/day. |
117 for report in db.Query(ProfileReport, keys_only=True).filter( | 117 for report in db.Query(ProfileReport, keys_only=True).filter( |
118 'date <', cutoff): | 118 'date <', cutoff): |
119 db.delete(report) | 119 db.delete(report) |
OLD | NEW |