Browse Source

Merge pull request #47 from zt-initech/reuse-https-connections

don't open a new https connection for every log flush
opensearch
Ido Halevi 5 years ago
committed by GitHub
parent
commit
a50287fc5b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      logzio/sender.py

+ 2
- 1
logzio/sender.py View File

@ -41,6 +41,7 @@ class LogzioSender:
self.logger = get_logger(debug)
self.backup_logs = backup_logs
self.network_timeout = network_timeout
self.requests_session = requests.Session()
# Function to see if the main thread is alive
self.is_main_thread_active = lambda: any(
@ -110,7 +111,7 @@ class LogzioSender:
for current_try in range(number_of_retries):
should_retry = False
try:
response = requests.post(
response = self.requests_session.post(
self.url, headers=headers, data='\n'.join(logs_list),
timeout=self.network_timeout)
if response.status_code != 200:


Loading…
Cancel
Save