Files
Hermes Agent 96a9a0536d
Build Media Mirror Worker / Build and publish (release) Successful in 1m25s
fix: устойчивое скачивание из Jellyfin — OkHttp + retry вместо HttpURLConnection
Прод-инцидент (3 джоба failed подряд): HttpURLConnection рвал скачивание
7.2 ГБ на ~5-й минуте ('Can't download video from Jellyfin'), при этом curl
с той же машины качал стабильно (HTTP/1.1 и HTTP/2). Сеть и Jellyfin чисты.

- JellyfinInput: OkHttpClient (readTimeout=0, followRedirects), byteStream→Files.copy,
  retry до 3 попыток с паузой 5с на IOException, warn-лог каждой попытки
- InputService: лог с полным stacktrace (реальная причина обрыва теперь видна)
2026-08-19 06:00:18 +03:00

103 lines
3.0 KiB
Kotlin

import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
kotlin("jvm") version "2.4.10"
kotlin("plugin.serialization") version "2.4.10"
id("org.springframework.boot") version "4.1.0"
jacoco
}
group = "pw.binom.mirror.worker"
version = "1.0.0-SNAPSHOT"
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
freeCompilerArgs.add("-Xjsr305=strict")
}
}
configurations {
named("runtimeClasspath") {
}
}
configurations.all {
resolutionStrategy {
force("org.testcontainers:testcontainers:1.21.4")
force("org.testcontainers:junit-jupiter:1.21.4")
force("org.testcontainers:postgresql:1.21.4")
force("org.testcontainers:minio:1.21.4")
}
}
dependencies {
implementation(platform("org.springframework.boot:spring-boot-dependencies:4.1.0"))
implementation("org.springframework.boot:spring-boot-starter-webmvc") {
exclude(group = "org.springframework.boot", module = "spring-boot-starter-jackson")
}
implementation("org.springframework.boot:spring-boot-starter-jdbc")
implementation("org.springframework.boot:spring-boot-starter-flyway")
implementation("org.flywaydb:flyway-database-postgresql")
implementation("org.postgresql:postgresql")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0")
implementation(platform("software.amazon.awssdk:bom:2.46.21"))
implementation("software.amazon.awssdk:s3")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation(kotlin("test-junit5"))
testImplementation("org.testcontainers:testcontainers:1.21.4")
testImplementation("org.testcontainers:junit-jupiter:1.21.4")
testImplementation("org.testcontainers:postgresql:1.21.4")
testImplementation("org.testcontainers:minio:1.21.4")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.2")
}
tasks.withType<Test> {
useJUnitPlatform()
maxParallelForks = 1
testLogging {
showStandardStreams = true
events("passed", "failed", "skipped")
}
}
tasks.withType<Jar> {
exclude("META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA")
}
tasks.jacocoTestReport {
dependsOn(tasks.test)
reports {
xml.required.set(true)
html.required.set(true)
}
}
tasks.jacocoTestCoverageVerification {
dependsOn(tasks.jacocoTestReport)
violationRules {
rule {
element = "PACKAGE"
includes = listOf("pw.binom.mirror.worker.convert")
limit {
counter = "LINE"
value = "COVEREDRATIO"
minimum = "0.80".toBigDecimal()
}
}
}
}
tasks.check {
dependsOn(tasks.jacocoTestReport, tasks.jacocoTestCoverageVerification)
}