Hi!

I am currently implementing the deferred library in my code, and I am
running into a very very strange problem.  The function that I am
deferring gets passed an entity key.  It does two tasks: 1) Gets the
entity,  retrieves a reference property, alters it, and then puts it
back 2)Sends out an email

The email is getting sent out every time the deferred function is
called.  BUT, the first task only completes 2/3 of the time.  I have
been replicating this error over and over and have yet to find any
pattern in the failures.  Here is the deferred function

def complete_insert(self, data, answer_key, userkey):
        a = db.get(answer_key)
        q = a.question
        q.answercount += 1
        q.answerers += [str(userkey)]
        q.answerers = list(set(q.answerers))
        q.answered = True
        q.lastanswer = str(answer_key)
        q.lastanswerdate = datetime.now()
        q.put()

        mail = Mail()
        followers = db.get(q.indexes.followerlist)
        emails = []
        for follower in followers:
            mail.send(emails, "question-followers-email", params =
{"question": common.strip_html(q.question),
"details":common.strip_html(q.details), "slug":q.slug,
"answer":common.strip_html(data["answer"])} )

A couple observations that make this even more boggling.  I can tell
when the function fails because the counter does not increment and the
other properties do not change.  However, when it fails, I can see the
put() being done in AppStats under /ah/deferred.  FURthermore, I have
checked that the values being passed into the function are the ones
that I am expecting.  (I did this by adding another put that wrote the
arguments to a test model)

I have absolutely no idea what could be going on here.  Is this a bug?

Very best and thanks for your time,
Aaron

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

Reply via email to