Read delay in App Engine Datastore after put()

江枫思渺然 提交于 2019-11-30 08:29:26

You're most likely being hit by "eventually consistent queries". When using the HR datastore, queries may use slightly old data, and it takes a while for data written by put() to be visible to queries (there is no such delay for get() by key or id). The delay is typically measured in seconds but I don't think we guarantee an upper bound -- if you're hit by an unfortunate network partition it might be hours, I imagine.

There are all sorts of partial solutions, from cheating when the author of the most recent writes is viewing the query results to using ancestor queries (which have their own share of limitations). You might simply give your cache a limited lifetime and update it on read instead of write.

Good luck!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!