Skip to content

Commit

Permalink
Merge pull request #75 from open-craft/artur/s3-timeout
Browse files Browse the repository at this point in the history
feat: valid S3 expiration time
  • Loading branch information
UsamaSadiq authored Jan 22, 2024
2 parents d32e7e4 + e99a9c8 commit c05fd61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion recommender/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# which is not loaded when running `manage.py` commands (which is used by `make compile_translations`)
# from .recommender import RecommenderXBlock

__version__ = '2.1.0'
__version__ = '2.1.1'
5 changes: 4 additions & 1 deletion recommender/recommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,10 @@ def _get_onetime_url(self, filename):
We benchmarked this as less than 8ms on a sandbox machine.
"""
if filename.startswith('fs://'):
return str(self.fs.get_url(filename.replace('fs://', ''), 1000 * 60 * 60 * 10))
# 604800 seconds is the maximum allowed expiration by S3.
# If this is instead filesystem-backed, the timeout argument has
# no effect.
return str(self.fs.get_url(filename.replace('fs://', ''), 604800))
else:
return filename

Expand Down

0 comments on commit c05fd61

Please sign in to comment.