-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add parallel processing for appender events
Introduced a `forEachParallel` extension function to run operations concurrently on collections using coroutines. Updated `RootLogger` to utilize this extension, improving efficiency in appender event processing.
- Loading branch information
1 parent
38d6636
commit a1aa04a
Showing
2 changed files
with
11 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
log4k/src/commonMain/kotlin/io/github/smyrgeorge/log4k/impl/extensions/iterable.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.github.smyrgeorge.log4k.impl.extensions | ||
|
||
import kotlinx.coroutines.async | ||
import kotlinx.coroutines.awaitAll | ||
import kotlinx.coroutines.withContext | ||
import kotlin.coroutines.EmptyCoroutineContext | ||
|
||
suspend fun <A> Iterable<A>.forEachParallel(f: suspend (A) -> Unit): Unit = | ||
withContext(EmptyCoroutineContext) { map { async { f(it) } }.awaitAll() } |