minou
minou

Reputation: 16563

GAE console updates not applying to deployed app (not eventual consistency)

My app is GAE standard.

I can edit an entity in the cloud console from a URL that starts with this:

https://console.cloud.google.com/datastore/entities/query

I'll save the entity and refresh the page and the new data is shown.

On my website, I then go to a page that retrieves the entity using the entity ID like this

e = Entity.get_by_id(1234)

But my website shows the old data! It seems like this shouldn't be possible.

My only solution is to then use remote api shell to get the entity (which shows the old data) and then update and then put the entity. My website then shows the new data.

How is it possible that updating an entity in the cloud console doesn't show up in production when getting an entity by its id?

Upvotes: 3

Views: 45

Answers (2)

GAEfan
GAEfan

Reputation: 11360

Try something like this:

e = Entity.get_by_id(1234, use_cache=False, use_memcache=False)

or

the_key = ndb.Key(Entity, 12345)
the_key.get(use_cache=False, use_memcache=False)

There are other params you can set, like memcache_timeout and read_policy:

https://cloud.google.com/appengine/docs/standard/python/ndb/functions#context_options

Upvotes: 3

Patrick Jones
Patrick Jones

Reputation: 319

This sounds like a caching problem - as the warning at the top of this page notes, updating entities via the datastore console doesn't update or flush the cache. You should try flushing the memcache via the console after you make an update, which will ensure that the query hits the datastore directly.

Upvotes: 2

Related Questions