summaryrefslogtreecommitdiffstats
path: root/funcweb
diff options
context:
space:
mode:
authormakkalot <makkalot@gmail.com>2008-07-24 15:32:01 +0300
committermakkalot <makkalot@gmail.com>2008-07-24 15:32:01 +0300
commitfeaf88b16606d2f1b8a1d061c5c398704df9d306 (patch)
treec87927b11151026b47f67e7f0c8eb11319347dc9 /funcweb
parent6834fc6c20041b5f32bea5f06723e51f36f2057a (diff)
downloadfunc-feaf88b16606d2f1b8a1d061c5c398704df9d306.tar.gz
func-feaf88b16606d2f1b8a1d061c5c398704df9d306.tar.xz
func-feaf88b16606d2f1b8a1d061c5c398704df9d306.zip
when short commands are executed succesfully we dont need again to notify the user, he already knows that :)
Diffstat (limited to 'funcweb')
-rw-r--r--funcweb/funcweb/controllers.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/funcweb/funcweb/controllers.py b/funcweb/funcweb/controllers.py
index 9e513a1..2f82e53 100644
--- a/funcweb/funcweb/controllers.py
+++ b/funcweb/funcweb/controllers.py
@@ -295,12 +295,22 @@ class Funcweb(object):
result_id = getattr(getattr(fc_async,module),method)(*cmd_args)
result = "".join(["The id for current job is :",str(result_id)," You will be notified when there is some change about that command !"])
+
+ #that part gives a chance for short methods to finish their jobs and display them
+ #immediately so user will not wait for new notifications for that short thing
import time
time.sleep(4)
tmp_as_res = fc_async.job_status(result_id)
if tmp_as_res[0] == JOB_ID_FINISHED:
result = tmp_as_res[1]
+ if not self.async_manager:
+ #cleanup tha database firstly
+ purge_old_jobs()
+ self.async_manager = AsyncResultManager()
+ self.async_manager.refresh_list()
+
+ #TODO reformat that returning string to be more elegant to display :)
return str(result)
else:
@@ -328,6 +338,7 @@ class Funcweb(object):
self.func_cache['modules']=None
self.func_cache['methods']=None
+ #i assume that they are long enough so dont poll here
result_id = getattr(getattr(fc,module),method)()
result = "".join(["The id for current id is :",str(result_id)," You will be notified when there is some change about that command !"])
return dict(result=str(result))