Our price job put back the stock our stock job had just sold out
On the Friday of a November promotion we sold three hundred and forty cordless drills on a marketplace that we did not have. The listing had said fourteen in stock for most of the afternoon. Our warehouse system had said zero since a quarter past one. Two of our integrations write to that marketplace's listings API. The stock job runs every five minutes: it fetches each changed listing, sets the…
On a November Friday, a promotion prompted the company to sell 340 cordless drills from a marketplace where only 14 were in stock. The warehouse system reported zero units since 1:15 PM. Two integrations were updating the listing, but they ran at different times and never synchronized. The price job and stock job began overlapping, causing conflicts.
Each job fetched the listing, made changes, and saved them, erasing the previous update. The API provided a solution with ETags, allowing jobs to detect changes since the last read. However, the jobs had been written without using the header, resulting in overwriting. The company canceled unsellable orders, suffered a seller rating hit, and started sending the If-Match header.
If the listing changed, they would fetch it again, apply their changes, and retry up to three times. The stock job was replaced with a separate inventory endpoint, and a daily check ensured the marketplace quantities matched the warehouse.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.