Background/ASync Processes occuring during/after change even

Discussions related to custom development with Select.
Post Reply
Keith.Gilbert
Posts: 13
Joined: Wed Apr 02, 2014 3:25 pm

Background/ASync Processes occuring during/after change even

Post by Keith.Gilbert »

While opening a new order, testers are entering transactions, and in some cases changing the order status to "Closed" all before the initial save of the order.

Our service is receiving a change event and invoking the API, but the Ledger Balance is calculating as 0.00 and Date Closed is not calculated. Subsequent saves to the order which trigger add'l change events seem to process correctly.

Is it possible that the change event for the initial save is happening during some type of background process or async processing which is still occuring by the time we grab the order?

If so, do we need to delay in order to allow these processes to complete before invoking the API?

Thank you.

Keith
Melissa McBerkowitz
Posts: 91
Joined: Wed Sep 10, 2008 3:33 pm
Location: Raleigh, NC
Contact:

Re: Background/ASync Processes occuring during/after change

Post by Melissa McBerkowitz »

When you say "change event", are you talking about subscribing to the order save notification or are you looking at the order history change events directly? In v3.0, all change events (aka order history details) are written out via async processing so that there's no delay to the order save itself. These records should be written within a minute or two, but it's certainly possible that you could receive a notification about the order save before the order history details are written. Looking at the ledger balance and closed date fields directly through the API (not at order history) should always return the correct current values, regardless of whether the order history process has run.

Can you provide more details about what you're trying to do with the order history data? Delaying your processing should avoid this problem, but we might be able to recommend a better option toward your end goal.
Melissa McBerkowitz
VP of Product Strategy, SoftPro
Post Reply