Closed JosiahRegencia closed 6 years ago
I was reading about psycopg2 patterns because not closing the cursor and the connection in query.py really bothered my. I read that it builds up cache. I read from this article about using decorators but from some forums I also read that decorators inside a class is pointless. This forum led me to the solution, instead. https://github.com/Doveps/mono/blob/02df17a70bfbea7be9b4ea1b994333e6616a9a27/savant/app/query.py#L209-L212
query.py
Short and effective. Surely works.
At the same time, had to put these functions back in query.py:
https://github.com/Doveps/mono/blob/02df17a70bfbea7be9b4ea1b994333e6616a9a27/savant/app/query.py#L180-L207
I transferred it to results.py in issue #145 but it doesn't go well withtravis testing. it fails. Putting it back in query.py fixes that issue.
results.py
travis
Screenshot of passed build:
Good, I remember using __del__ before too, seems like the right way to do it.
__del__
I notice those four functions are mostly identical. Any ideas on de-duplicating?
I was reading about psycopg2 patterns because not closing the cursor and the connection in
query.py
really bothered my. I read that it builds up cache. I read from this article about using decorators but from some forums I also read that decorators inside a class is pointless. This forum led me to the solution, instead. https://github.com/Doveps/mono/blob/02df17a70bfbea7be9b4ea1b994333e6616a9a27/savant/app/query.py#L209-L212Short and effective. Surely works.
At the same time, had to put these functions back in
query.py
:https://github.com/Doveps/mono/blob/02df17a70bfbea7be9b4ea1b994333e6616a9a27/savant/app/query.py#L180-L207
I transferred it to
results.py
in issue #145 but it doesn't go well withtravis
testing. it fails. Putting it back inquery.py
fixes that issue.Screenshot of passed build: