Tried with defer.execute for the async-save intead. Still issues with multiple objects.
This commit is contained in:
parent
78e12b3aba
commit
791b380693
1 changed files with 8 additions and 2 deletions
|
|
@ -21,7 +21,7 @@ from manager import SharedMemoryManager
|
||||||
# is used by SharedMemoryBase.save().
|
# is used by SharedMemoryBase.save().
|
||||||
#
|
#
|
||||||
|
|
||||||
from twisted.internet.defer import DeferredQueue
|
from twisted.internet.defer import DeferredQueue, execute
|
||||||
from twisted.internet.task import cooperate
|
from twisted.internet.task import cooperate
|
||||||
from twisted.internet.threads import deferToThread, blockingCallFromThread
|
from twisted.internet.threads import deferToThread, blockingCallFromThread
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
@ -37,7 +37,13 @@ ASYNC_QUEUE = DeferredQueue(backlog=1)
|
||||||
def async_callback(funcdef):
|
def async_callback(funcdef):
|
||||||
"This callback is run with the item returned from queue - a tuple (func, args, kwargs)"
|
"This callback is run with the item returned from queue - a tuple (func, args, kwargs)"
|
||||||
#d = deferToThread(funcdef[0], *funcdef[1], **funcdef[2])
|
#d = deferToThread(funcdef[0], *funcdef[1], **funcdef[2])
|
||||||
d = reactor.callFromThread(funcdef[0], *funcdef[1], **funcdef[2])
|
logger.log_infomsg("Callback")
|
||||||
|
def threadback(r):
|
||||||
|
print "Thread returned."
|
||||||
|
def threaderr(failure):
|
||||||
|
print "Thread error" + str(failure)
|
||||||
|
#d = reactor.callFromThread(funcdef[0], *funcdef[1], **funcdef[2]).addCallbacks(threadback, threaderr)1
|
||||||
|
d = execute(funcdef[0], *funcdef[1], **funcdef[2]).addCallbacks(threadback, threaderr)
|
||||||
#d = reactor.blockingCallFromThread(funcdef[0], *funcdef[1], **funcdef[2])
|
#d = reactor.blockingCallFromThread(funcdef[0], *funcdef[1], **funcdef[2])
|
||||||
return d
|
return d
|
||||||
def async_errback(failure):
|
def async_errback(failure):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue