fix threads loss

This commit is contained in:
Maksim Fomenkov
2022-11-29 14:12:20 +04:00
parent feb9cb6a0f
commit 7e51b2859b

View File

@@ -53,11 +53,12 @@ abstract class AbstractHead(
val delay = System.currentTimeMillis() - lastHeadUpdated
if (delay > awaitHeadTimeoutMs) {
log.warn("No head updates for $delay ms @ ${this.javaClass} - restart")
try {
lock.tryLock()
start()
} finally {
lock.unlock()
if (lock.tryLock()) {
try {
start()
} finally {
lock.unlock()
}
}
}
}, 300, 30, TimeUnit.SECONDS