Skip to content

Commit

Permalink
fix: empty contacts task
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed May 1, 2022
1 parent e9cf691 commit 109d2ee
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ abstract class GitHubSubscriber<T>(private val name: String, parent: CoroutineSc
}
}

private fun task(id: String) = synchronized(jobs) { tasks[id] }?.takeIf { it.contacts.isNotEmpty() }
private fun task(id: String): GitHubTask? = synchronized(jobs) {
tasks.compute(id) { _, old ->
old?.takeIf { it.contacts.isNotEmpty() }
}
}

private fun launch(id: String) = launch(SupervisorJob()) {
logger.info { "$name with $id run start" }
Expand Down

0 comments on commit 109d2ee

Please sign in to comment.