Don Mitchell
07/01/2025, 6:53 PMabstract class TraversingPrimitivePreprocessor : Preprocessor {
abstract fun handle(node: PrimitiveNode, context: DecoderContext): ConfigResult<Node>
needs to use the kotlin aws sdk to get the value. All of the kotlin aws sdk methods are appropriately suspending. Of course Claude spams runBlocking which I know how to use and to avoid if at all possible.kevin.cianfarini
07/01/2025, 6:55 PMhandle isn't called from a coroutine, then runBlocking is fine. Otherwise, I'm actually not sure off the top of my head.Bogdan Vladoiu Lbs
07/01/2025, 8:28 PMkevin.cianfarini
07/01/2025, 8:31 PMhandle returns a value which, presumably, he derives from some AWS dataDon Mitchell
07/01/2025, 8:33 PMBogdan Vladoiu Lbs
07/01/2025, 8:35 PMDon Mitchell
07/01/2025, 8:35 PMcom.sksamuel.hoplite.preprocessor.TraversingPrimitivePreprocessorDon Mitchell
07/01/2025, 8:35 PMDon Mitchell
07/01/2025, 8:36 PMkevin.cianfarini
07/01/2025, 8:36 PMrunBlocking.Bogdan Vladoiu Lbs
07/01/2025, 8:38 PMDon Mitchell
07/01/2025, 8:38 PMkevin.cianfarini
07/01/2025, 8:38 PMBogdan Vladoiu Lbs
07/01/2025, 8:38 PMJonathan
07/02/2025, 12:40 PMrunBlocking initially?
The documentation runBlocking says the following:
It is designed to bridge regular blocking code to libraries that are written in suspending style, to be used inMaybe I’m missing something but it looks like the best solution.functions and in tests.main
Don Mitchell
07/02/2025, 12:44 PMrunBlocking actually prevents coroutine process swapping (thus the name blocking) and when nested can cause process deadlocks. That is, if the coroutine pool is i and there are _i_/2 parallel parents each trying to create i/2 chilldren each using runBlocking, you'll run out of pool after the first parent spawns all its children and the other ones won't be able to spawn theirs until the first finishes. The children won't take turns as they will block. (I'm fudging a bit based on having 2 conceptual models which clash on whether the blocking is per CPU or something else.)kevin.cianfarini
07/02/2025, 12:45 PMrunBlocking should really be marked as @DelicateCoroutinesApi because of the deadlocking problem.Don Mitchell
07/02/2025, 12:47 PMrunBlocking across my code base. So, like an ex-smoker, I'm zealous about abolishing them now 😆Bogdan Vladoiu Lbs
07/02/2025, 1:09 PMmarcinmoskala
07/02/2025, 1:16 PMrunBlocking, because:
1. You need result (if you don’t, it is typically better to use scope.launch {})
2. You can block the caller (at least I assume so from how it looks)
runBlocking is the proper way to call suspending calls from blocking functions.kevin.cianfarini
07/02/2025, 2:11 PMmain function able to call suspending code.
• Calling suspending code from a function you don't control like this thread talks about.marcinmoskala
07/02/2025, 3:02 PMJoffrey
07/03/2025, 10:41 AMmain function can be marked suspend itself, this is no longer a valid runBlocking case (or at least not a case that requires runBlocking)marcinmoskala
07/03/2025, 11:10 AM