Hello All,

Using Django 1.1.1. Today I found some very strange behaviour when
trying to use theading, from what I understand it is different from
the notes on trac of querysets not being thread safe.

Basic issue trying to execute queries while in a thread always returns
an original query. Probably best explained with an example (bit rushed
by time at the end of the day! Sorry for the non generic example.):

http://pastebin.com/m63211552

Basic example of format:
Main Thread: print objects.all()
Spawned Thread: print objects.all() -- same as main thread
Main Thread: objects.create(newObj)
Main Thread: print.objects.all() -- correct queryset, original + new
Spawned Thread: print objects.all() -- only contains the original
objects, not the new one?

Full output (also shown in pastebin)
test: [<TestRunServer: Kieran Test (172.25.130.25:8778)>]
In thread
threadTest: [<TestRunServer: Kieran Test (172.25.130.25:8778)>]
Thread waiting
Creating new db entry
test: [<TestRunServer: Kieran Test (172.25.130.25:8778)>,
<TestRunServer: Test (
172.25.31.11:1234)>]
threadTest: [<TestRunServer: Kieran Test (172.25.130.25:8778)>]

Thank you,
Kieran


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


Reply via email to