mirror of
https://github.com/corda/corda.git
synced 2025-01-29 15:43:55 +00:00
CORDA-2991 (Cont): set node info polling interval to 1 second in DriverDSL Node Startup (#5285)
* Fix test execution flakiness on fast hardware: set node info polling interval to 1 second in DriverDSL Node Startup (was only being set to 1 sec in Node Registration). Follow-up to https://github.com/corda/corda/pull/5240 * Diagnostics: add additional logging to NodeInfoFilersCopier. * Diagnostics: add additional logging to NodeInfoWatcher * Downgrade logging level severity to debug. * Make atomic counter unique across instances.
This commit is contained in:
parent
1fc1e7d6c8
commit
b4749eb8f9
@ -3,6 +3,7 @@ package net.corda.nodeapi.internal.network
|
||||
import net.corda.core.internal.*
|
||||
import net.corda.core.utilities.contextLogger
|
||||
import net.corda.core.internal.NODE_INFO_DIRECTORY
|
||||
import net.corda.core.utilities.debug
|
||||
import rx.Observable
|
||||
import rx.Scheduler
|
||||
import rx.Subscription
|
||||
@ -21,7 +22,7 @@ import java.util.concurrent.TimeUnit
|
||||
* This class will create paths that it needs to poll and to where it needs to copy files in case those
|
||||
* don't exist yet.
|
||||
*/
|
||||
class NodeInfoFilesCopier(scheduler: Scheduler = Schedulers.io()) : AutoCloseable {
|
||||
class NodeInfoFilesCopier(private val scheduler: Scheduler = Schedulers.io()) : AutoCloseable {
|
||||
|
||||
companion object {
|
||||
private val log = contextLogger()
|
||||
@ -122,6 +123,7 @@ class NodeInfoFilesCopier(scheduler: Scheduler = Schedulers.io()) : AutoCloseabl
|
||||
}
|
||||
|
||||
private fun atomicCopy(source: Path, destination: Path) {
|
||||
log.debug { "[${scheduler.now()}] Copying ... $source -> $destination" }
|
||||
val tempDestination = try {
|
||||
Files.createTempFile(destination.parent, "", null)
|
||||
} catch (exception: IOException) {
|
||||
|
@ -78,9 +78,12 @@ class NodeInfoWatcher(private val nodePath: Path,
|
||||
}
|
||||
|
||||
private fun pollDirectory(): List<NodeInfoUpdate> {
|
||||
logger.debug { "pollDirectory $nodeInfosDir" }
|
||||
val processedPaths = HashSet<Path>()
|
||||
val result = nodeInfosDir.list { paths ->
|
||||
paths
|
||||
.filter { logger.debug { "Examining $it" }
|
||||
true}
|
||||
.filter { it.isRegularFile() }
|
||||
.filter { file ->
|
||||
val lastModifiedTime = file.lastModifiedTime()
|
||||
|
@ -112,9 +112,6 @@ class DriverDSLImpl(
|
||||
private lateinit var _notaries: CordaFuture<List<NotaryHandle>>
|
||||
override val notaryHandles: List<NotaryHandle> get() = _notaries.getOrThrow()
|
||||
|
||||
// While starting with inProcess mode, we need to have different names to avoid clashes
|
||||
private val inMemoryCounter = AtomicInteger()
|
||||
|
||||
interface Waitable {
|
||||
@Throws(InterruptedException::class)
|
||||
fun waitFor()
|
||||
@ -239,7 +236,8 @@ class DriverDSLImpl(
|
||||
NodeConfiguration::useTestClock.name to useTestClock,
|
||||
NodeConfiguration::rpcUsers.name to if (users.isEmpty()) defaultRpcUserList else users.map { it.toConfig().root().unwrapped() },
|
||||
NodeConfiguration::verifierType.name to parameters.verifierType.name,
|
||||
NodeConfiguration::flowOverrides.name to flowOverrideConfig.toConfig().root().unwrapped()
|
||||
NodeConfiguration::flowOverrides.name to flowOverrideConfig.toConfig().root().unwrapped(),
|
||||
NodeConfiguration::additionalNodeInfoPollingFrequencyMsec.name to 1000
|
||||
) + czUrlConfig + jmxConfig + parameters.customOverrides
|
||||
val config = NodeConfig(ConfigHelper.loadConfig(
|
||||
baseDirectory = baseDirectory(name),
|
||||
@ -678,6 +676,9 @@ class DriverDSLImpl(
|
||||
companion object {
|
||||
internal val log = contextLogger()
|
||||
|
||||
// While starting with inProcess mode, we need to have different names to avoid clashes
|
||||
private val inMemoryCounter = AtomicInteger()
|
||||
|
||||
private val notaryHandleTimeout = Duration.ofMinutes(1)
|
||||
private val defaultRpcUserList = listOf(InternalUser("default", "default", setOf("ALL")).toConfig().root().unwrapped())
|
||||
private val names = arrayOf(ALICE_NAME, BOB_NAME, DUMMY_BANK_A_NAME)
|
||||
|
Loading…
x
Reference in New Issue
Block a user