Skip to content

Commit

Permalink
Merge pull request #156 from CDLUC3/jan2024t
Browse files Browse the repository at this point in the history
trigger regeneration of presigned url
  • Loading branch information
terrywbrady authored Jan 26, 2024
2 parents 50810cd + b16235d commit 70920dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/assets/javascripts/presign_progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ var AssemblyProgress = function(assembler, pDialogs) {
// If the val is not numeric, the process is being initialized
if (!jQuery.isNumeric(val)) {
val = self.assembler.getPercent();
// if the assembly dialog is not visible, force the regeneration of a presigned URL
// by setting the progress value to 90%
if (val == 100 && !jQuery( ".progress-label:visible" ).is()){
val = 90;
}
self.setProgressVal(val);
}

Expand Down
4 changes: 3 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,12 @@ def presign_obj_by_token
end

def do_presign_obj_by_token(token, filename = 'object.zip', no_redirect = nil)
# Do not set timer to more than 6 * 60 since AWS host credentials for presigned expire at 6 hours
# see https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html#who-presigned-url
r = create_http_cli(connect: 5, receive: 5, send: 5).get(
File.join(APP_CONFIG['storage_presign_token'], token),
{
timeout: 12 * 60,
timeout: 6 * 60,
contentDisposition: "attachment; filename=#{filename}"
},
follow_redirect: true
Expand Down

0 comments on commit 70920dc

Please sign in to comment.