I found the solution, I was making it too complicated. Thank you for indirectly solving my problem.
I moved the whol stuff to the cron job and make the frontend lean and mean. So no need anymore for threads the frontend. One question. when I run web2py in a cronjob can I use thread there ? Or is it also connected to the webserver ? > Thanks for the response, > > > There are two problems: > > - do not do print, breaks mod_wsgi > > - do not start threads from an action because the threads are > > controller by the web server and it may kill it. > > Good warnings. > > > you should queue the task in database or cache and then run a > > background task > > Well actually its function is to queue tasks in redis so a cronjob can > excute it. > > Well it seems I get errors while accessing the database > > File gluon/contrib/pymysql/connections.py", line 184, in > defaulterrorhandler raise errorclass, errorvalue > gluon.contrib.pymysql.err.InterfaceError: (0, '') > > > . > > If pushing data to redis takes too long it defies the purpose of using > > redis. > > Well its collecting the data and combining it in redis that takes time. > > > On Oct 9, 11:22 pm, Mike Veltman <mike.velt...@gmail.com> wrote: > > > Ok, I need to push data in a redis database. And my problem is that it > > > takes a while while the data is pushed in. So the screen would be > > > waiting and a user would be irritated. > > > > > > My solution would be something like this. > > > > > > if framequeue.check_frame_lock() == False: > > > if session.deployment == True: > > > pass > > > > > > else: > > > import thread > > > print session.deployment > > > print "Running deployment" > > > thread.start_new_thread(default_frame_deployment,()) > > > > > > So the thread is running in the background and the page displays the > > > log. > > > > > > But then I get gluon (database) errors in the functions. > > > > > > Any idea's or is there a better/ more elegant solution to this problem > > > ? > > > > > > With regards, > > > Mike Veltman > > With regards, > Mike Veltman With regards, Mike Veltman