diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-11-10 13:37:46 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-11-10 13:37:46 +0700 |
| commit | b4e74170aeaf00937f78e5af9047218ddb17516c (patch) | |
| tree | b8afcc874d664d0eadfc0249c148997588cc11fd /indoteknik_custom/models/solr/apache_solr_queue.py | |
| parent | 321eb7701fa2172ae3d1f633774702e4a8f8a380 (diff) | |
Add parameter on delete weekly solr
Diffstat (limited to 'indoteknik_custom/models/solr/apache_solr_queue.py')
| -rw-r--r-- | indoteknik_custom/models/solr/apache_solr_queue.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/indoteknik_custom/models/solr/apache_solr_queue.py b/indoteknik_custom/models/solr/apache_solr_queue.py index 8dd7c273..07274295 100644 --- a/indoteknik_custom/models/solr/apache_solr_queue.py +++ b/indoteknik_custom/models/solr/apache_solr_queue.py @@ -72,11 +72,12 @@ class ApacheSolrQueue(models.Model): if count == 0: self.create(payload) - def delete_weekly_solr(self, limit=500): + def delete_weekly_solr(self, limit=500, days_after=30): solr = self.search([ ('execute_status', '=', 'success'), - ('execute_date', '>=', (datetime.utcnow() - timedelta(days=7))), + ('execute_date', '>=', (datetime.utcnow() - timedelta(days=days_after))), ], limit=limit) + for rec in solr: rec.unlink() |
