Skip to content

Commit

Permalink
Merge pull request #46 from p2p-org/fix_threads
Browse files Browse the repository at this point in the history
fix threads loss
  • Loading branch information
MaxFomenkov authored Nov 29, 2022
2 parents feb9cb6 + d922a15 commit f780a54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ group = 'io.emeraldpay.dshackle'
// Version schema:
// x.x.x for production, following SemVer model
// x.x.x-SNAPSHOT for development
version = '0.14.0-SNAPSHOT'
version = '0.15.0-SNAPSHOT'

java {
sourceCompatibility = JavaVersion.VERSION_13
Expand Down Expand Up @@ -177,7 +177,7 @@ jib {
}
}
container {
jvmFlags = ['-Xms1024m', '-XX:MaxRAMPercentage=60']
jvmFlags = ['-Xms1024m', '-Xmx4g']
mainClass = 'io.emeraldpay.dshackle.StarterKt'
args = []
ports = ['2448', '2449', '8545']
Expand Down
11 changes: 6 additions & 5 deletions src/main/kotlin/io/emeraldpay/dshackle/upstream/AbstractHead.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f780a54

Please sign in to comment.