Skip to content

Commit

Permalink
bugfix: Retry check for the latest MEtals version
Browse files Browse the repository at this point in the history
Fixes #5952
  • Loading branch information
tgodzik committed Dec 19, 2023
1 parent 6473e38 commit d596f64
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion metals-docs/src/main/scala/docs/Snapshot.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ object Snapshot {
private implicit val localDateTimeOrdering: Ordering[LocalDateTime] =
Ordering.fromLessThan[LocalDateTime]((a, b) => a.compareTo(b) < 0)

def latest(repo: String, binaryVersion: String): Snapshot = {
def latest(repo: String, binaryVersion: String, retry: Int = 5): Snapshot = {
if (System.getenv("CI") != null) {
try {
fetchLatest(repo, binaryVersion)
} catch {
case NonFatal(e) if retry > 0 =>
scribe.error(
"unexpected error fetching SNAPSHOT version, retrying...",
e,
)
latest(repo, binaryVersion, retry - 1)
case NonFatal(e) =>
scribe.error("unexpected error fetching SNAPSHOT version", e)
current
Expand Down

0 comments on commit d596f64

Please sign in to comment.