From 265c45499661b9164d8b5d5302bdeda409085981 Mon Sep 17 00:00:00 2001 From: Stavros Sachtouris <saxtouri@admin.grnet.gr> Date: Tue, 5 May 2015 12:43:03 +0300 Subject: [PATCH] Stop caching nwjs sessions Cache is not useful in the context of the present application. --- agkyra/agkyra/gui.py | 14 ++++++-------- agkyra/agkyra/gui/package.json | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/agkyra/agkyra/gui.py b/agkyra/agkyra/gui.py index 1365c19..ade74b3 100644 --- a/agkyra/agkyra/gui.py +++ b/agkyra/agkyra/gui.py @@ -22,26 +22,28 @@ from ws4py.client import WebSocketBaseClient from tempfile import NamedTemporaryFile import subprocess import json -from os.path import abspath, join +from os.path import abspath from threading import Thread from hashlib import sha1 import os import logging CURPATH = os.path.dirname(os.path.abspath(__file__)) - LOG = logging.getLogger(__name__) class GUI(WebSocketBaseClient): """Launch the GUI when the helper server is ready""" - def __init__(self, addr, gui_id): + def __init__(self, addr, gui_id, **kwargs): """Initialize the GUI Launcher""" super(GUI, self).__init__(addr) self.addr = addr self.gui_id = gui_id self.start = self.connect + self.nw = kwargs.get( + 'nw', os.path.join(os.path.join(CURPATH, 'nwjs'), 'nw')) + self.gui_code = kwargs.get('gui_code', os.path.join(CURPATH, 'gui.nw')) def run_gui(self): """Launch the GUI and keep it running, clean up afterwards. @@ -55,11 +57,7 @@ class GUI(WebSocketBaseClient): json.dump(dict(gui_id=self.gui_id, address=self.addr), fp) # subprocess.call blocks the execution LOG.debug('RUN: %s' % (fp.name)) - subprocess.call([ - os.path.join(os.path.join(CURPATH, 'nwjs'), 'nw'), - os.path.join(CURPATH, 'gui.nw'), - fp.name, - '--data-path', abspath('~/.agkyra')]) + subprocess.call([self.nw, self.gui_code, fp.name]) LOG.debug('GUI process closed, remove temp file') os.remove(fp.name) diff --git a/agkyra/agkyra/gui/package.json b/agkyra/agkyra/gui/package.json index e6731e9..c1492e4 100644 --- a/agkyra/agkyra/gui/package.json +++ b/agkyra/agkyra/gui/package.json @@ -13,5 +13,5 @@ "web": "http://www.synnefo.org" }], "licences": [{"type": "GPLv3"}], - "chromium-args": "--incognito" + "page-cache": false } -- GitLab