Skip to content

Instantly share code, notes, and snippets.

@perses76
Created September 28, 2011 10:38
Show Gist options
  • Select an option

  • Save perses76/1247615 to your computer and use it in GitHub Desktop.

Select an option

Save perses76/1247615 to your computer and use it in GitHub Desktop.
Django Threading problem
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