Skip to content

Fix coroutine activity check in DefaultCoreTimer#16

Merged
rezapour merged 1 commit intodevelopfrom
codex/review-code
Apr 6, 2026
Merged

Fix coroutine activity check in DefaultCoreTimer#16
rezapour merged 1 commit intodevelopfrom
codex/review-code

Conversation

@rezapour
Copy link
Copy Markdown
Owner

@rezapour rezapour commented Apr 4, 2026

Motivation

  • Ensure the timer loop respects coroutine cancellation by checking the actual coroutine context isActive instead of the previously imported NonCancellable.isActive.

Description

  • In core/timer-core/src/main/java/me/rezapour/timer_core/impl/DefaultTimerEngine.kt replaced import kotlinx.coroutines.NonCancellable.isActive with import kotlinx.coroutines.currentCoroutineContext and import kotlinx.coroutines.isActive, and updated the loop to while (currentCoroutineContext().isActive && _status.value == CoreTimerStatus.Running) so cancellation is evaluated against the running job.

Testing

  • Ran ./gradlew test and ./gradlew :core:timer-core:test --stacktrace, both could not complete in this environment due to a Gradle/Kotlin JVM version parse error (IllegalArgumentException: 25.0.1).

Codex Task

@rezapour rezapour merged commit 86a2d20 into develop Apr 6, 2026
1 check passed
@rezapour rezapour deleted the codex/review-code branch April 6, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant