Skip to content

Commit

Permalink
fix: made should_reload into a blocking call (#21)
Browse files Browse the repository at this point in the history
* Made should_reload into a blocking call

* Removed should_reload() unit test, as this will now wait forever.
  • Loading branch information
stuartbeattie84 authored May 17, 2022
1 parent d0d7e37 commit 6fd89b5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
3 changes: 1 addition & 2 deletions postgresql_watcher/watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def create_subscriber_process(
)
if start_process:
p.start()
self.should_reload()
return p

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

def should_reload(self):
try:
if self.parent_conn.poll():
if self.parent_conn.poll(None):
message = self.parent_conn.recv()
print(f"message:{message}")
return True
Expand Down
3 changes: 0 additions & 3 deletions tests/test_postgresql_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ def test_pg_watcher_init(self):
def test_update_pg_watcher(self):
assert pg_watcher.update() is True

def test_not_reload(self):
assert not pg_watcher.should_reload()

def test_default_update_callback(self):
assert pg_watcher.update_callback() is None

Expand Down

0 comments on commit 6fd89b5

Please sign in to comment.