Skip to content

Commit 66f494c

Browse files
committed
remove unuseful commits
1 parent b820c8d commit 66f494c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

postgrestq/task_queue.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,14 @@ def __init__(
7878

7979
def connect(self) -> None:
8080
"""
81-
Establish a connection to Postgres.
82-
If a connection already exists, it's overwritten.
81+
Creates a ConnectionPool and waits until a connection to Postgres is
82+
established.
8383
"""
84-
# if self.conn is None or self.conn.closed:
85-
# self.conn = self.get_connection()
86-
self.pool = ConnectionPool(self._dsn, open=True, min_size=1)
84+
self.pool = ConnectionPool(self._dsn, open=True, min_size=2)
8785
# This will block the use of the pool until min_size connections
8886
# have been acquired
8987
self.pool.wait()
88+
logger.info("ConnectionPool is ready")
9089

9190
def _create_queue_table(self) -> None:
9291
"""
@@ -439,7 +438,7 @@ def complete(self, task_id: Optional[UUID]) -> int:
439438
if count == 0:
440439
logger.info(f"Task {task_id} was already completed")
441440

442-
conn.commit()
441+
conn.commit()
443442
return count
444443

445444
def is_empty(self) -> bool:
@@ -575,7 +574,6 @@ def get_updated_expired_task(
575574
),
576575
)
577576
updated_row = cur.fetchone()
578-
conn.commit()
579577
if updated_row is None:
580578
return None, None
581579

0 commit comments

Comments
 (0)