fix(projects): parallelize project indexing with coroutines

This commit is contained in:
Akash Yadav
2023-10-02 15:05:21 +05:30
parent 1d54a3ff4d
commit 66aa9099b4
6 changed files with 75 additions and 24 deletions
@@ -48,3 +48,21 @@ constructor(
lastLap = System.currentTimeMillis()
}
}
/**
* Run the given action with a stopwatch to log the time the action took to execute.
*
* @see StopWatch
*/
inline fun <R> withStopWatch(
label: String,
start: Long = System.currentTimeMillis(),
lastLap: Long = start,
action: (StopWatch) -> R
): R {
return StopWatch(label, start, lastLap).run {
action(this).also {
log()
}
}
}