Skip to content

Commit

Permalink
set tcp_keepalive=True for the boto3 s3 client
Browse files Browse the repository at this point in the history
this seems like a smart thing to do anyway, even though the connection
issues that are motivating the retries are on the zoom side.

See: https://www.miketheman.net/2022/10/04/reduce-aws-lambda-latencies-with-keep-alive-in-python/
  • Loading branch information
lbjay committed Jul 23, 2024
1 parent 89087c1 commit 8263b89
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion functions/zoom-downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import logging
import concurrent.futures
from copy import deepcopy
from botocore.config import Config
from tenacity import (
Retrying,
RetryError,
Expand Down Expand Up @@ -57,7 +58,7 @@ class ZoomDownloadLinkError(Exception):


sqs = boto3.resource("sqs")
s3 = boto3.client("s3")
s3 = boto3.client("s3", config=Config(tcp_keepalive=True))


@setup_logging
Expand Down Expand Up @@ -368,6 +369,7 @@ def upload_to_s3(self):
for file in self.recording_files:
try:
retry_attempts = Retrying(
reraise=True,
stop=stop_after_attempt(STREAM_FROM_ZOOM_TO_S3_RETRIES),
wait=wait_fixed(STREAM_FROM_ZOOM_TO_S3_RETRY_WAIT),
retry=retry_if_exception_type(RetryableDownloadError),
Expand Down

0 comments on commit 8263b89

Please sign in to comment.