Skip to content

Commit

Permalink
[IMP] shopinvader_cart_expiry: improve job
Browse files Browse the repository at this point in the history
Improve the job in charge of unlink old carts by adding an identity key (to avoid having too much jobs who are doing the same cleaning on the same backend)
  • Loading branch information
acsonefho committed Jun 11, 2024
1 parent 2f22c7a commit 6eed2de
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion shopinvader_cart_expiry/models/shopinvader_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ def _scheduler_manage_cart_expiry(self, domain=False):
domain = expression.AND([domain, [("cart_expiry_delay", ">", 0)]])
for backend in self.search(domain):
description = _("Manage cart expired for backend %s") % backend.name
backend.with_delay(description=description).manage_cart_expiry()
backend.with_delay(
description=description,
identity_key="shopinvader_manage_cart_expiry_%s" % (str(backend.id),),
).manage_cart_expiry()

def _get_cart_expiry_delay_domain(self):
expiry_date = fields.Datetime.from_string(fields.Datetime.now())
Expand Down

0 comments on commit 6eed2de

Please sign in to comment.