Skip to content

Commit 6fd89b5

Browse files
fix: made should_reload into a blocking call (#21)
* Made should_reload into a blocking call * Removed should_reload() unit test, as this will now wait forever.
1 parent d0d7e37 commit 6fd89b5

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

postgresql_watcher/watcher.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def create_subscriber_process(
8787
)
8888
if start_process:
8989
p.start()
90-
self.should_reload()
9190
return p
9291

9392
def set_update_callback(self, fn_name: Callable):
@@ -113,7 +112,7 @@ def update(self):
113112

114113
def should_reload(self):
115114
try:
116-
if self.parent_conn.poll():
115+
if self.parent_conn.poll(None):
117116
message = self.parent_conn.recv()
118117
print(f"message:{message}")
119118
return True

tests/test_postgresql_watcher.py

-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ def test_pg_watcher_init(self):
3939
def test_update_pg_watcher(self):
4040
assert pg_watcher.update() is True
4141

42-
def test_not_reload(self):
43-
assert not pg_watcher.should_reload()
44-
4542
def test_default_update_callback(self):
4643
assert pg_watcher.update_callback() is None
4744

0 commit comments

Comments
 (0)