diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2023-10-03 07:05:14 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2023-10-03 07:05:14 +0000 |
| commit | 19e0be70679ed862453fedeba14fb4cdf02232e9 (patch) | |
| tree | 69b578c47cc17ae477c58d8bda718d823b998b20 /indoteknik_custom/models/solr/apache_solr_queue.py | |
| parent | 78f205302c35cab2512971d64c8152aab2dcfa95 (diff) | |
| parent | d238f43442cc27db0d0c05bba99b42b41eaadf54 (diff) | |
Merged in production (pull request #128)
Production
Diffstat (limited to 'indoteknik_custom/models/solr/apache_solr_queue.py')
| -rw-r--r-- | indoteknik_custom/models/solr/apache_solr_queue.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/indoteknik_custom/models/solr/apache_solr_queue.py b/indoteknik_custom/models/solr/apache_solr_queue.py index 6a5b480f..8dd7c273 100644 --- a/indoteknik_custom/models/solr/apache_solr_queue.py +++ b/indoteknik_custom/models/solr/apache_solr_queue.py @@ -1,5 +1,5 @@ from odoo import models, fields -from datetime import datetime +from datetime import datetime, timedelta import logging, time @@ -72,3 +72,12 @@ class ApacheSolrQueue(models.Model): if count == 0: self.create(payload) + def delete_weekly_solr(self, limit=500): + solr = self.search([ + ('execute_status', '=', 'success'), + ('execute_date', '>=', (datetime.utcnow() - timedelta(days=7))), + ], limit=limit) + for rec in solr: + rec.unlink() + + |
