Skip to content

Commit

Permalink
fix bug that prevents graceful exit
Browse files Browse the repository at this point in the history
  • Loading branch information
troyraen committed Oct 27, 2021
1 parent 5bea06e commit 37b6db6
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions stream/management/commands/pittgoogle.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,15 @@ def handle(self, *args, **options):
- Block until the processing is complete and the connection has been closed.
"""
_ = self.consumer.stream_alerts(
user_filter=self.parse_and_save, # callback to process alerts
self.consumer.stream_alerts(
# callback=self.parse_and_save,
user_filter=self.parse_and_save,
parameters=PITTGOOGLE_CONSUMER_CONFIGURATION, # stopping conditions
)

@staticmethod
def parse_and_save(alert, parameters):
"""Parse the alert and save to the database.
Used as the callback in `self.consumer.stream_alerts`.
"""
"""Parse the alert and save to the database."""
mylogger = logging.getLogger(__name__)
mylogger.info("Success! We have pulled an alert.")

# TODO: write the parse and save
success = True
return success
return alert

0 comments on commit 37b6db6

Please sign in to comment.