Created
September 28, 2011 10:38
-
-
Save perses76/1247615 to your computer and use it in GitHub Desktop.
Django Threading problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import threading | |
| from task.models import Task | |
| from django.test import TestCase | |
| class TestThread(TestCase): | |
| def test_run(self): | |
| ts = [Job() for x in range(5)] | |
| for t in ts: | |
| t.start() | |
| class Job(threading.Thread): | |
| def run(self): | |
| try: | |
| t = Task.objects.all() | |
| print len(t) | |
| except Exception as ex: | |
| print ex.message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment