Okay, useful to know it is not the absence of a commit. Each time the 
problem has occurred there has not been a ticket. 

The ipn messages from paypal are rather like a scheduled task. So I use 
them.They seem to be reliable. But although they passed through the 
'update_record', they did crash later, so they effectively did not commit. 
So that explains to me why my second line of defence failed. I am still 
bemused why the controller presented above failed to carry out the 
update_record however.

Now that I can be more confident that my second line of defence  (the 
ipn_handler) will sort out any failed update_records I feel more secure the 
system will be reliable.


Thanks for your input everyone.

Those errors that do not get us to loose all credibility with our clients 
do help us to learn, with the aid of this forum.

Peter 

On Tuesday, 2 June 2015 13:12:31 UTC+1, Anthony wrote:
>
> If this is in the context of an HTTP request, then web2py automatically 
> handles the commit, so calling db.commit() is unnecessary. If the 
> transaction is failing to commit, that means that your code is throwing an 
> exception sometime *after* the confirmation email gets sent to the user 
> (which seems unlikely given that that is the last line of the controller -- 
> though the problem could be in the view). Were there any error tickets 
> associated with the cases where the database update failed?
>
> Anyway, be careful calling db.commit(). When an exception occurs, any 
> database operations are automatically rolled back, which is usually what 
> you want. If you call db.commit() in the middle of a request, any database 
> operations up to that point will be committed, regardless of any subsequent 
> exceptions encountered in the code.
>
> One option to consider is to use the scheduler to schedule the email to be 
> sent to the user after the request has been processed. The email task could 
> first confirm the database update and then send the email only in case the 
> confirmation was successful.
>
> Anthony
>
> On Tuesday, June 2, 2015 at 7:43:04 AM UTC-4, peter wrote:
>>
>> Yes Thanks Dmitry
>>  
>> Maybe that is the problem. I always forget about commit().
>>
>> I will add this in. 
>>
>> It will take me a while to know if it is the solution as the problem only 
>> occurs every few months. 
>>
>> If I commit() does not sort it I will report back to the group eventually!
>>
>> Peter
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to