summaryrefslogtreecommitdiff
path: root/fixco_custom/models/webhook_ginee.py
diff options
context:
space:
mode:
Diffstat (limited to 'fixco_custom/models/webhook_ginee.py')
-rwxr-xr-xfixco_custom/models/webhook_ginee.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/fixco_custom/models/webhook_ginee.py b/fixco_custom/models/webhook_ginee.py
index 606bd21..444306b 100755
--- a/fixco_custom/models/webhook_ginee.py
+++ b/fixco_custom/models/webhook_ginee.py
@@ -19,23 +19,24 @@ class WebhookGinee(models.Model):
('not_found', 'Record not found')
], 'Execute Status')
- # def process_queue_item(self, limit=100, max_exec_time=30):
- # domain = [('execute_status', '=', False)]
- # records = self.search(domain, order='create_date asc', limit=limit)
- # start_time = time.time()
- # for rec in records:
- # end_time = time.time()
- # elapsed_time = end_time - start_time
- # if elapsed_time > max_exec_time:
- # break
- # rec.execute_queue()
-
- def process_queue_item(self, limit=100):
+ def process_queue_item(self, limit=100, max_exec_time=30):
domain = [('execute_status', '=', False)]
records = self.search(domain, order='create_date asc', limit=limit)
+ start_time = time.time()
for rec in records:
+ end_time = time.time()
+ elapsed_time = end_time - start_time
+ if elapsed_time > max_exec_time:
+ break
rec.execute_queue()
+ # def process_queue_item(self, limit=100):
+ # domain = [('create_date', '>', '2025-12-31 23:59:59')]
+ # records = self.search(domain, order='create_date asc', limit=limit)
+ # for rec in records:
+ # rec.execute_queue()
+
+
def execute_queue(self):
detail_order = self.env['detail.order'].create({
'json_ginee': self.json_ginee,