0

I'm building a Shopify App and I got stuck as the app was behaving strangely.

I investigated the issue and I found out that saving a product with the Shopify API and then asking Shopify to read the just saved values still outputs outdated information.

Reading the product again after a few seconds outputs the true values of the saved product.

It seems Shopify is caching the query of a product and for a few seconds (with my tests the threshold seem to be 7 seconds) still replies with old data. Is this true?

In this case is there a way to tell Shopify to refresh the data of a product? For example in Ruby on Rails I could just use the ".reload" method on the object.

My problem is that if a user is using the Shopify website admin and updates a product rapidly - lets say it is entering updated stock quantity for different variants - the product-update webhook is called rapidly and the second webhook call doesn't read the changes made by the first webhook call.

Thanks!

4

1 回答 1

0

也许来自 shopify 的人会有更好的答案,但我注意到了同样的行为 - 我的假设不是它正在缓存,而是更改排队,所以在处理之前可能会有延迟。我通过在我的 webhook 处理中添加延迟来解决它 - 所以当 webhook 进入时我的脚本会立即响应(使用 200,并关闭连接),但然后延迟执行以在应用我的更改之前让更改生效.

于 2013-01-07T16:29:42.930 回答