Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #76 from istresearch/PULSE-4186
Browse files Browse the repository at this point in the history
Updated Traptor with try catch for ChunkedEncodingError
  • Loading branch information
artem-IST authored Jun 9, 2017
2 parents ac49e19 + 45395f7 commit 27fcdc3
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions traptor/traptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from tenacity import retry, wait_exponential, stop_after_attempt, retry_if_exception_type, wait_chain, wait_fixed

from dog_whistle import dw_config, dw_callback
from requests.exceptions import ChunkedEncodingError

from scutils.log_factory import LogFactory
from scutils.stats_collector import StatsCollector
from traptor_limit_counter import TraptorLimitCounter
Expand Down Expand Up @@ -1101,8 +1103,17 @@ def run(self):

self.restart_flag = False

# Start collecting data
self._main_loop()
try:
# Start collecting data
self._main_loop()
except ChunkedEncodingError as e:
self.logger.error("Ran into a ChunkedEncodingError while processing "
"tweets. Restarting Traptor from top of main process "
"loop", {
'ex' : traceback.format_exc()
})




def main():
Expand Down Expand Up @@ -1193,7 +1204,7 @@ def main():

dd_monitoring.increment('traptor_error_occurred',
tags=['error_type:traptor_start'])

raise e

if __name__ == '__main__':
from raven import Client
Expand Down

0 comments on commit 27fcdc3

Please sign in to comment.