Skip to content

Commit

Permalink
Ensure we are not shutting down when pausing or unpausing.
Browse files Browse the repository at this point in the history
Refs #2877
  • Loading branch information
coleifer committed Apr 26, 2024
1 parent 519a84e commit 68fb127
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions playhouse/sqliteq.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,23 @@ def is_stopped(self):
return self._is_stopped

def pause(self):
evt = self._thread_helper.event()
self._write_queue.put((PAUSE, evt))
with self._qlock:
if self._is_stopped:
return False

evt = self._thread_helper.event()
self._write_queue.put((PAUSE, evt))

evt.wait()

def unpause(self):
evt = self._thread_helper.event()
self._write_queue.put((UNPAUSE, evt))
with self._qlock:
if self._is_stopped:
return False

evt = self._thread_helper.event()
self._write_queue.put((UNPAUSE, evt))

evt.wait()

def __unsupported__(self, *args, **kwargs):
Expand Down

0 comments on commit 68fb127

Please sign in to comment.