Skip to content

Commit 3e3ceb9

Browse files
committed
RHELMISC-7213: Fix share folder handle_exceptions
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 <vitalii@daynix.com>
1 parent 217a660 commit 3e3ceb9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/resultuploaders/dropbox/dropbox.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,14 @@ def connect
118118
end
119119

120120
def create_project_folder
121+
@path = "/#{@repo}/CI/#{@tag}-#{@timestamp}"
122+
handle_exceptions(__method__) { @dropbox.create_folder(@path) }
121123
handle_exceptions(__method__) do
122-
@path = "/#{@repo}/CI/#{@tag}-#{@timestamp}"
123-
@dropbox.create_folder(@path)
124124
@dropbox.share_folder(@path)
125125
@url = "#{@dropbox.create_shared_link_with_settings(@path).url}&lst="
126-
@logger.info("Dropbox project folder created: #{@url}")
127126
end
127+
128+
@logger.info("Dropbox project folder created: #{@url}")
128129
end
129130

130131
def upload_file(l_path, r_name)

0 commit comments

Comments
 (0)