[Gradle] Fix failures in reporting were saved effectively statically
This commit is contained in:
committed by
Space Team
parent
3f3d6fc74e
commit
25004a4842
+11
-13
@@ -25,21 +25,19 @@ class HttpReportServiceImpl(
|
|||||||
) : HttpReportService, Serializable {
|
) : HttpReportService, Serializable {
|
||||||
constructor(httpSettings: HttpReportSettings) : this(httpSettings.url, httpSettings.password, httpSettings.user)
|
constructor(httpSettings: HttpReportSettings) : this(httpSettings.url, httpSettings.password, httpSettings.user)
|
||||||
|
|
||||||
companion object {
|
private var invalidUrl = false
|
||||||
private var invalidUrl = false
|
private var requestPreviousFailed = false
|
||||||
private var requestPreviousFailed = false
|
|
||||||
|
|
||||||
private fun checkResponseAndLog(connection: HttpURLConnection, log: Logger) {
|
private fun checkResponseAndLog(connection: HttpURLConnection, log: Logger) {
|
||||||
val isResponseBad = connection.responseCode !in 200..299
|
val isResponseBad = connection.responseCode !in 200..299
|
||||||
if (isResponseBad) {
|
if (isResponseBad) {
|
||||||
val message = "Failed to send statistic to ${connection.url} with ${connection.responseCode}: ${connection.responseMessage}"
|
val message = "Failed to send statistic to ${connection.url} with ${connection.responseCode}: ${connection.responseMessage}"
|
||||||
if (!requestPreviousFailed) {
|
if (!requestPreviousFailed) {
|
||||||
log.warn(message)
|
log.warn(message)
|
||||||
} else {
|
} else {
|
||||||
log.debug(message)
|
log.debug(message)
|
||||||
}
|
|
||||||
requestPreviousFailed = true
|
|
||||||
}
|
}
|
||||||
|
requestPreviousFailed = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user