1
0
mirror of https://github.com/gsi-upm/senpy synced 2024-11-24 09:02:28 +00:00

use plug._plain_dict() before returning from analyse()

We're experiencing significant delays when we have large objects as plugin instance variables. This edit seems to fix the problem.

It looks like the plugin instance is passed (inside the response object) as-is to flask: perhaps flask is walking through it or duplicating it in memory or some such? Not sure...

There may be a better way?
This commit is contained in:
drevicko 2017-02-01 17:24:55 +00:00 committed by GitHub
parent 40b67503ce
commit 19d12a74cd

View File

@ -103,7 +103,7 @@ class Senpy(object):
nif_params.update(specific_params) nif_params.update(specific_params)
try: try:
resp = plug.analyse(**nif_params) resp = plug.analyse(**nif_params)
resp.analysis.append(plug) resp.analysis.append(plug._plain_dict())
logger.debug("Returning analysis result: {}".format(resp)) logger.debug("Returning analysis result: {}".format(resp))
except Exception as ex: except Exception as ex:
resp = Error(message=str(ex), status=500) resp = Error(message=str(ex), status=500)