Skip to content

Commit

Permalink
FixUp
Browse files Browse the repository at this point in the history
  • Loading branch information
index-git committed Sep 25, 2023
1 parent 825bdb3 commit efd563b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/db/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def get_connection_pool(db_uri_str=None, encapsulate_exception=True):
if not connection_pool:
db_uri_parsed = parse.urlparse(db_uri_str)
try:
connection_pool = psycopg2.pool.ThreadedConnectionPool(5, 50,
connection_pool = psycopg2.pool.ThreadedConnectionPool(3, 20,
user=db_uri_parsed.username,
password=db_uri_parsed.password,
host=db_uri_parsed.hostname,
Expand Down Expand Up @@ -51,8 +51,7 @@ def run_query(query, data=None, uri_str=None, encapsulate_exception=True, log_qu
raise Error(2) from exc
raise exc
finally:
if pool and conn:
pool.putconn(conn)
pool.putconn(conn)

return rows

Expand All @@ -74,8 +73,7 @@ def run_statement(query, data=None, uri_str=None, encapsulate_exception=True, lo
raise Error(2) from exc
raise exc
finally:
if pool and conn:
pool.putconn(conn)
pool.putconn(conn)

return rows

Expand Down
2 changes: 1 addition & 1 deletion src/layman/layer/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def get_most_frequent_lower_distance(schema, table_name, primary_key, geometry_c
# print(query)

try:
rows = db_util.run_query(query, uri_str)
rows = db_util.run_query(query, uri_str=uri_str)
except BaseException as exc:
logger.error(f'get_most_frequent_lower_distance ERROR')
raise LaymanError(7) from exc
Expand Down

0 comments on commit efd563b

Please sign in to comment.