fix for lp742650
This commit is contained in:
parent
c7555d66e5
commit
620c2dabfa
@ -108,17 +108,17 @@ class AjaxConsoleProxy(object):
|
||||
return "Server Error"
|
||||
|
||||
def register_listeners(self):
|
||||
class Callback:
|
||||
def __call__(self, data, message):
|
||||
if data['method'] == 'authorize_ajax_console':
|
||||
AjaxConsoleProxy.tokens[data['args']['token']] = \
|
||||
{'args': data['args'], 'last_activity': time.time()}
|
||||
class TopicProxy():
|
||||
@staticmethod
|
||||
def authorize_ajax_console(context, **kwargs):
|
||||
AjaxConsoleProxy.tokens[kwargs['token']] = \
|
||||
{'args': kwargs, 'last_activity': time.time()}
|
||||
|
||||
conn = rpc.Connection.instance(new=True)
|
||||
consumer = rpc.TopicAdapterConsumer(
|
||||
connection=conn,
|
||||
topic=FLAGS.ajax_console_proxy_topic)
|
||||
consumer.register_callback(Callback())
|
||||
connection=conn,
|
||||
proxy=TopicProxy,
|
||||
topic=FLAGS.ajax_console_proxy_topic)
|
||||
|
||||
def delete_expired_tokens():
|
||||
now = time.time()
|
||||
@ -130,8 +130,7 @@ class AjaxConsoleProxy(object):
|
||||
for k in to_delete:
|
||||
del AjaxConsoleProxy.tokens[k]
|
||||
|
||||
utils.LoopingCall(consumer.fetch, auto_ack=True,
|
||||
enable_callbacks=True).start(0.1)
|
||||
utils.LoopingCall(consumer.fetch, enable_callbacks=True).start(0.1)
|
||||
utils.LoopingCall(delete_expired_tokens).start(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user