On 4/26/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote:
> I have a particular file-processing "cron" job that uses django.
> Something much like this:
>
> while True:
>         for image in Image.objects.filter(processing_state="pending"):
>                 #process image
>         time.sleep(30)

The simplest thing to do is take it out of the "while True" loop and
let the process die between runs.

The next simplest, which may or may not work, is importing and
committing yourself:
from django.db import transaction
transaction.commit()

If that doesn't work, you've got an odd situation going on and I'd
want to see that "#process image" code.  But this will force the
connection to close, if you're sure you want that:
from django.db import connection
connection.close()

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to