Skip to content

Commit

Permalink
RHELMISC-7213: Fix share folder handle_exceptions
Browse files Browse the repository at this point in the history
Fix retry behavior in handle_exceptions when share_folder fails.
Previously, when share_folder failed, handle_exceptions would retry
the entire block, attempting to create an already existing folder.
This led to unnecessary retries and potential errors.

Now the operations are separated:
- Folder creation has its own exception handling block
- Share folder and link generation are handled separately
- Prevents redundant folder creation attempts during retries

This ensures cleaner retry logic and proper error handling for
each operation independently.

Signed-off-by: Vitalii Chulak <[email protected]>
  • Loading branch information
Jedoku committed Feb 28, 2025
1 parent 177e338 commit df0845d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/resultuploaders/dropbox/dropbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ def connect
def create_project_folder
handle_exceptions(__method__) do
@path = "/#{@repo}/CI/#{@tag}-#{@timestamp}"
@dropbox.create_folder(@path)
begin
@dropbox.create_folder(@path)
rescue DropboxApi::Errors::FolderConflictError
@logger.warn("Dropbox project folder already exists: #{@path}")
end
@dropbox.share_folder(@path)
@url = "#{@dropbox.create_shared_link_with_settings(@path).url}&lst="
@logger.info("Dropbox project folder created: #{@url}")
Expand Down

0 comments on commit df0845d

Please sign in to comment.