Skip to content

Commit

Permalink
OJ-39279: fix error handling when submitting logs to JF (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinpitt-jf authored Oct 16, 2024
1 parent abd2131 commit 3875546
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions jf_agent/agent_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ def post_logs_to_jellyfish(self, now: datetime) -> bool:
),
headers=headers,
)

resp = conn.getresponse()

if resp.status == 200:
self.batches_sent += 1
self.messages_to_send = []
self.last_message_send_time = now
except:
self.post_errors += 1
if self.post_errors < self.post_error_threshold:
Expand All @@ -186,13 +193,6 @@ def post_logs_to_jellyfish(self, now: datetime) -> bool:
)
return

resp = conn.getresponse()

if resp.status == 200:
self.batches_sent += 1
self.messages_to_send = []
self.last_message_send_time = now

def handle(self, record: Union[logging.LogRecord, int]) -> None:
now = datetime.now()

Expand Down

0 comments on commit 3875546

Please sign in to comment.