Skip to content

Commit 6ba49a9

Browse files
committed
[IMP] pg: tiny simplification
When using a `Cursor` in a `with` statement, it will be committed automatically. No need to do it explicitly and no need to save the rowcount in a local var. closes #279 Signed-off-by: Christophe Simonis (chs) <chs@odoo.com>
1 parent 6f1cfcd commit 6ba49a9

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/util/pg.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ def _parallel_execute_threaded(cr, queries, logger=_logger):
111111
def execute(query):
112112
with cursor() as tcr:
113113
tcr.execute(query)
114-
cnt = tcr.rowcount
115-
tcr.commit()
116-
return cnt
114+
return tcr.rowcount
117115

118116
cr.commit()
119117

0 commit comments

Comments
 (0)