Salutations Ankur,

You should look into sharded counters 
<https://cloud.google.com/appengine/articles/sharding_counters>. When you 
have too many updates to the same entity you can run into situations where 
you have multiple updates happening at once, which leads to to incorrect 
results.

On Thursday, July 9, 2015 at 7:33:42 AM UTC-4, Ankur Jatt wrote:
>
> Here is the situation
> I have a model like
>
> class Content(ndb.Model):
>     likeCount=ndb.IntegerProperty(default=0)
>     likeUser  = ndb.KeyProperty(kind=User, repeated=True)
>
> When a new content generate than a new "Content" object is generated like
>
> content_obj = Content(parent=objContentData.key, #Where ContentData is 
> another ndb.Model subclass
>                                  likeUser=[],
>                                  likeCount=0
>                                )
>
> And when any user like the same content than below function gets called
>
> def modify_like(contentData_key, user_key):
>     like_obj = Content.query(parent=contetData_key).get()
>     if like_obj:
>         like_obj.likeUser.append(user_key)
>         like_obj.likeCount += 1
>         like_obj.put()
>
> ###################Problem#############
> Now the problem is that when at the same time more than 4 user like the 
> same content than this object write wrong data.
> So how can I solve this problem
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/b10bc20d-79cc-4275-8ad1-79d50e39c5b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to