mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: null safety, update date/time libraries, and migrate tests (#4900)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
f826cac6c8
commit
664ebf218e
163 changed files with 503 additions and 4993 deletions
|
|
@ -43,19 +43,18 @@ class SequentialJob {
|
|||
*/
|
||||
fun launch(scope: CoroutineScope, timeoutMs: Long = 0, block: suspend CoroutineScope.() -> Unit) {
|
||||
cancel()
|
||||
val newJob =
|
||||
scope.handledLaunch {
|
||||
if (timeoutMs > 0) {
|
||||
try {
|
||||
withTimeout(timeoutMs, block)
|
||||
} catch (e: TimeoutCancellationException) {
|
||||
Logger.w { "SequentialJob timed out after ${timeoutMs}ms" }
|
||||
throw e
|
||||
}
|
||||
} else {
|
||||
block()
|
||||
val newJob = scope.handledLaunch {
|
||||
if (timeoutMs > 0) {
|
||||
try {
|
||||
withTimeout(timeoutMs, block)
|
||||
} catch (e: TimeoutCancellationException) {
|
||||
Logger.w { "SequentialJob timed out after ${timeoutMs}ms" }
|
||||
throw e
|
||||
}
|
||||
} else {
|
||||
block()
|
||||
}
|
||||
}
|
||||
job.value = newJob
|
||||
|
||||
newJob.invokeOnCompletion { job.compareAndSet(newJob, null) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue