[Gradle] Fix failures in reporting were saved effectively statically

This commit is contained in:
Alexander.Likhachev
2023-01-11 02:19:00 +01:00
committed by Space Team
parent 3f3d6fc74e
commit 25004a4842
@@ -25,21 +25,19 @@ class HttpReportServiceImpl(
) : HttpReportService, Serializable {
constructor(httpSettings: HttpReportSettings) : this(httpSettings.url, httpSettings.password, httpSettings.user)
companion object {
private var invalidUrl = false
private var requestPreviousFailed = false
private var invalidUrl = false
private var requestPreviousFailed = false
private fun checkResponseAndLog(connection: HttpURLConnection, log: Logger) {
val isResponseBad = connection.responseCode !in 200..299
if (isResponseBad) {
val message = "Failed to send statistic to ${connection.url} with ${connection.responseCode}: ${connection.responseMessage}"
if (!requestPreviousFailed) {
log.warn(message)
} else {
log.debug(message)
}
requestPreviousFailed = true
private fun checkResponseAndLog(connection: HttpURLConnection, log: Logger) {
val isResponseBad = connection.responseCode !in 200..299
if (isResponseBad) {
val message = "Failed to send statistic to ${connection.url} with ${connection.responseCode}: ${connection.responseMessage}"
if (!requestPreviousFailed) {
log.warn(message)
} else {
log.debug(message)
}
requestPreviousFailed = true
}
}