From 3084a1449bea2e1f395ce730a54fcb1f466d4a7f Mon Sep 17 00:00:00 2001 From: cssxsh Date: Tue, 24 Aug 2021 04:37:27 +0800 Subject: [PATCH] fix: GitHubTask --- .../kotlin/io/github/gnuf0rce/mirai/plugin/GitHubSubscriber.kt | 2 +- .../kotlin/io/github/gnuf0rce/mirai/plugin/data/GitHubTask.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/io/github/gnuf0rce/mirai/plugin/GitHubSubscriber.kt b/src/main/kotlin/io/github/gnuf0rce/mirai/plugin/GitHubSubscriber.kt index 53f3979..5e784b9 100644 --- a/src/main/kotlin/io/github/gnuf0rce/mirai/plugin/GitHubSubscriber.kt +++ b/src/main/kotlin/io/github/gnuf0rce/mirai/plugin/GitHubSubscriber.kt @@ -74,7 +74,7 @@ abstract class GitHubSubscriber(private val name: String, scope: } } - private fun task(id: String) = synchronized(jobs) { tasks[id] }.takeIf { it?.contacts.isNullOrEmpty() } + private fun task(id: String) = synchronized(jobs) { tasks[id] }?.takeIf { it.contacts.isNotEmpty() } private fun run(id: String) = launch(SupervisorJob()) { logger.info { "$name with $id run start" } diff --git a/src/main/kotlin/io/github/gnuf0rce/mirai/plugin/data/GitHubTask.kt b/src/main/kotlin/io/github/gnuf0rce/mirai/plugin/data/GitHubTask.kt index 7a978e1..e376ae6 100644 --- a/src/main/kotlin/io/github/gnuf0rce/mirai/plugin/data/GitHubTask.kt +++ b/src/main/kotlin/io/github/gnuf0rce/mirai/plugin/data/GitHubTask.kt @@ -12,7 +12,7 @@ data class GitHubTask( val contacts: MutableSet = mutableSetOf(), @SerialName("last") @Serializable(OffsetDateTimeSerializer::class) - var last: OffsetDateTime = OffsetDateTime.MIN, + var last: OffsetDateTime = OffsetDateTime.now(), @SerialName("interval") var interval: Long = 600_000L )