Skip to content

Commit

Permalink
Use self.is_stop_requested() method, set type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
dagardner-nv committed Aug 9, 2024
1 parent 9e10924 commit 5412076
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,11 @@ def __init__(self,
self._exchange_type = exchange_type
self._queue_name = queue_name

self._connection = None
self._connection: pika.BlockingConnection = None
self._channel = None

self._poll_interval = pd.Timedelta(poll_interval)

# Flag to indicate whether or not we should stop
self._stop_requested = False

@property
def name(self) -> str:
return "from-rabbitmq"
Expand Down Expand Up @@ -117,7 +114,7 @@ def connect(self):

def source_generator(self):
try:
while not self._stop_requested:
while not self.is_stop_requested():
(method_frame, _, body) = self._channel.basic_get(self._queue_name)
if method_frame is not None:
try:
Expand Down

0 comments on commit 5412076

Please sign in to comment.