Queue guest document extraction
All checks were successful
build-and-deploy / build-deploy (push) Successful in 3m36s

This commit is contained in:
androidlover5842
2026-01-30 15:08:47 +05:30
parent 69e51deeca
commit 21721d3905
2 changed files with 88 additions and 55 deletions

View File

@@ -0,0 +1,27 @@
package com.android.trisolarisserver.component
import jakarta.annotation.PreDestroy
import org.springframework.stereotype.Component
import java.util.concurrent.Executors
@Component
class ExtractionQueue {
private val executor = Executors.newSingleThreadExecutor { runnable ->
Thread(runnable, "doc-extraction-queue").apply { isDaemon = true }
}
fun enqueue(task: () -> Unit) {
executor.submit {
try {
task()
} catch (_: Exception) {
// Best-effort processing; failures should not crash the worker.
}
}
}
@PreDestroy
fun shutdown() {
executor.shutdown()
}
}