Skip to content

Commit afb1cda

Browse files
using for loop instead of repeat
1 parent a396715 commit afb1cda

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/kotlin/com/stefanbratanov/sofiasupermarketsapi/brochure/FantasticoBrochureDownloader.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ class FantasticoBrochureDownloader(@Value("\${fantastico.url}") private val url:
8080
val flippingBookUrl = it.attr("data-url")
8181

8282
// loading the flipping book
83-
repeat(3) {
84-
try {
85-
driver.get(flippingBookUrl)
86-
} catch (_: TimeoutException) {
83+
for (attempt in 1..3) try {
84+
driver.get(flippingBookUrl)
85+
break
86+
} catch (_: TimeoutException) {
87+
if (attempt != 3) {
8788
log.warn("Retrying loading flipping book due to timeout...")
8889
}
8990
}

0 commit comments

Comments
 (0)