Skip to content

Commit 109d2ee

Browse files
committed
fix: empty contacts task
1 parent e9cf691 commit 109d2ee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/kotlin/io/github/gnuf0rce/mirai/plugin/GitHubSubscriber.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ abstract class GitHubSubscriber<T>(private val name: String, parent: CoroutineSc
102102
}
103103
}
104104

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

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

0 commit comments

Comments
 (0)