question

pttommy avatar image
pttommy asked David Marginian Deactivated answered

OrderConnector.getOrder returns outdated version of order

One process in our product updates an existing order through the REST API, then sends a notification to our app to display the order on the device. The problem is that when we call getOrder on the OrderConnector (v3), often it returns an old version of the order, so we end up showing the wrong data to the user.

We tried to work around it by adding a 10 second delay before sending the notification after updating the order through the REST API, but even that is not 100% reliable. Is there any way to force the OrderConnector to load the latest version of the order?

Orders
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
David Marginian avatar image
David Marginian Deactivated answered

OrderConnector will retrieve the order from the device if the order has already synced (exists on the device). If you need to update the order off of the device (REST API) and require the latest changes you need to ensure the changes have synced down to the device. One way to do this is to pass the modified time of the order (from your REST call) with the notification and then use that modified time to loop on OrderConnector until the one device order is > or = to the modified time you pass.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community