Skip to content

Commit 5c7c677

Browse files
increase connection and read timeouts
1 parent b499a22 commit 5c7c677

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

core/src/main/scala/com/codacy/analysis/core/git/Repository.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.codacy.analysis.core.git
22

33
import org.eclipse.jgit.api.{Git => JGit}
44
import org.eclipse.jgit.lib.{Repository => JGitRepository}
5+
import org.eclipse.jgit.api.errors.GitAPIException;
56

67
import scala.collection.JavaConverters._
78
import scala.util.Try
@@ -11,13 +12,16 @@ class Repository(repository: JGitRepository) {
1112
val jGit: JGit = new JGit(repository)
1213

1314
def latestCommit: Try[Commit] = {
14-
Try {
15+
try {
1516
val gitLog = jGit.log().setMaxCount(1).call()
1617

1718
val revCommit = gitLog.iterator().next()
1819

1920
new Commit(repository, revCommit)
2021
}
22+
catch (GitAPIException | IOException e) {
23+
System.err.println("An error occurred while getting the latest commit: " + e.getMessage());
24+
e.printStackTrace();
2125
}
2226

2327
def uncommitedFiles: Try[Set[String]] = {

core/src/main/scala/com/codacy/analysis/core/utils/HttpHelper.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import scalaj.http.{Http, HttpOptions, HttpRequest, HttpResponse}
77

88
class HttpHelper(apiUrl: String, extraHeaders: Map[String, String], allowUnsafeSSL: Boolean) {
99

10-
private lazy val connectionTimeoutMs = 2000
11-
private lazy val readTimeoutMs = 5000
10+
private lazy val connectionTimeoutMs = 5000
11+
private lazy val readTimeoutMs = 15000
1212

1313
private val remoteUrl = apiUrl + "/2.0"
1414

0 commit comments

Comments
 (0)