How long after the call to deferred.defer are you running the loop
that checks that datastore has a record for each value in memcache?

Perhaps you're running the loop before a deferred task has had a
chance to run, in some cases?

Nick Verne

On Thu, Jan 5, 2012 at 4:09 AM, Felippe Bueno <felippe.bu...@gmail.com> wrote:
>
> Hello friends,
>
> I'm getting a strange task queue/datastore/memcache behavior.
>
> I have something like the following code:
>
> report = memcache.get(id)
>
> if not report:
>   try:
>    if not deferred.defer(self.addindex, id=id):
>       logging.error('cannot store task for report index')
>       report = False
>    else:
>       memcache.set(id, 1)
>  except:
>   logging.error('cannot store task for report index')
>   report=False
>
>
> def addindex(id)
>  reportindex=Foo(id=id)
>  try:
>   reportindex.put()
>  except Exception, e:
>   logging.error('can not put report index')
>
>
> When I can not put 'reportindex' I'm getting the logging.error as expected.
> But some times, I don't get the error, and don't have related id into the
> DS.
>
> To prove that was an error, I wrote to run every hour something like:
>
> for x in range(startid, lastid):
>   if memcache.get('%s' % x) and not Foo.all().filter('id', x).fetch(1):
>     logging.error('there is no register for id %s' %x)
>     a=Foo(id=x)
>     a.put()
>
>
>
> The problem is that I need Foo() to "index" memcache.
>
> Is this an expected behavior ?
> Should I trust on deferred.defer() ?
>
>
> Thanks a lot
> Felippe Bueno
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to google-appengine@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to