Skip to content

Commit

Permalink
Remove limit due to looping
Browse files Browse the repository at this point in the history
  • Loading branch information
ellbristow committed Jun 7, 2024
1 parent 1ead5a4 commit 674ef0a
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions delivery_parcelhub_whistl/models/delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def whistl_cancel_shipment(self, pickings):
)
picking.state = "cancel"

def _whistl_get_waiting_pickings(self, limit=100):
def _whistl_get_waiting_pickings(self):
return self.env["stock.picking"].search(
[
("carrier_id", "=", self.id),
Expand All @@ -565,20 +565,15 @@ def _whistl_get_waiting_pickings(self, limit=100):
"|",
("carrier_consignment_ref", "!=", False),
("carrier_tracking_ref", "!=", False),
],
limit=limit, # Added this to fix timeouts etc
]
)

def whistl_tracking_state_update_scheduled(self, batch_size=100):
pickings = self._whistl_get_waiting_pickings(limit=batch_size)
def whistl_tracking_state_update_scheduled(self):
pickings = self._whistl_get_waiting_pickings()
for picking in pickings:
if picking.delivery_state in ["customer_delivered", "warehouse_delivered"]:
continue
self.whistl_tracking_state_update(picking)
if self._whistl_get_waiting_pickings():
self.with_delay().whistl_tracking_state_update_scheduled(
batch_size=batch_size
)

def whistl_tracking_state_update(self, picking):
request_url = self._get_whistl_tracking_url(
Expand Down

0 comments on commit 674ef0a

Please sign in to comment.