upgrade ktlint plugin to 12.0.3 (#4169)
There are some new rules, I think they mostly make sense, except for the max line length which I had to disable because we are over it in a lot of places. --------- Co-authored-by: Goooler <wangzongler@gmail.com>
This commit is contained in:
parent
33cd6fdb98
commit
5192fb08a5
215 changed files with 2813 additions and 1177 deletions
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
package com.keylesspalace.tusky.util
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.TimeMark
|
||||
import kotlin.time.TimeSource
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flow
|
||||
|
||||
/**
|
||||
* Returns a flow that mirrors the original flow, but filters out values that occur within
|
||||
|
|
@ -53,15 +53,13 @@ import kotlin.time.TimeSource
|
|||
* @param timeout Emissions within this duration of the last emission are filtered
|
||||
* @param timeSource Used to measure elapsed time. Normally only overridden in tests
|
||||
*/
|
||||
fun <T> Flow<T>.throttleFirst(
|
||||
timeout: Duration,
|
||||
timeSource: TimeSource = TimeSource.Monotonic
|
||||
) = flow {
|
||||
var marker: TimeMark? = null
|
||||
collect {
|
||||
if (marker == null || marker!!.elapsedNow() >= timeout) {
|
||||
emit(it)
|
||||
marker = timeSource.markNow()
|
||||
fun <T> Flow<T>.throttleFirst(timeout: Duration, timeSource: TimeSource = TimeSource.Monotonic) =
|
||||
flow {
|
||||
var marker: TimeMark? = null
|
||||
collect {
|
||||
if (marker == null || marker!!.elapsedNow() >= timeout) {
|
||||
emit(it)
|
||||
marker = timeSource.markNow()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue