[Zope3-Users] lovely.remotetask question
Maciej Wisniowski
maciej.wisniowski at coig.katowice.pl
Tue Apr 3 06:00:13 EDT 2007
Hi
I want to use lovely.remotetask in Z3 application.
Use case is very simple:
User views page, this causes long running function to be started
and Ajax calls from the page check every second if there is a result.
I have:
1. content object (Folderish) with instance of remotetask.TaskService()
called 'monitor_service' inside
2. mytask = remotetask.task.SimpleTask(myLongRunningFunction)
3. named utility for 'mytask'
The question is how should I start and stop remotetask jobs?
Currently, when user enters a page I call (every time):
jobid = self['monitor_service'].add(u'mytask', appdict)
self['monitor_service'].startProcessing()
Then ajax is repeadetly checking for result and when
status is Completed I call
self['monitor_service'].stopProcessing()
It works nice, but after looking into service.py code I see
it will break when I'll have few concurrent users.
Seems that I should call startProcessing() on zope startup
and stopProcessing on zope shutdown?
How should I use that (in my use case)?
Without call to stopProcessing I'm unable to stop Zope.
--
Maciej Wisniowski
More information about the Zope3-users
mailing list