|
|
@ -24,6 +24,8 @@ import kotlinx.coroutines.asCoroutineDispatcher |
|
|
|
import kotlinx.coroutines.launch |
|
|
|
import kotlinx.coroutines.launch |
|
|
|
import java.util.concurrent.Executors |
|
|
|
import java.util.concurrent.Executors |
|
|
|
import kotlin.math.min |
|
|
|
import kotlin.math.min |
|
|
|
|
|
|
|
import org.mozilla.javascript.WrappedException |
|
|
|
|
|
|
|
import javax.script.ScriptException |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 校验书源 |
|
|
|
* 校验书源 |
|
|
@ -176,18 +178,15 @@ class CheckSourceService : BaseService() { |
|
|
|
}.timeout(CheckSource.timeout) |
|
|
|
}.timeout(CheckSource.timeout) |
|
|
|
.onError(searchCoroutine) { |
|
|
|
.onError(searchCoroutine) { |
|
|
|
when(it) { |
|
|
|
when(it) { |
|
|
|
//校验超时不能正常实现 不能识别 |
|
|
|
|
|
|
|
is TimeoutCancellationException -> source.addGroup("校验超时") |
|
|
|
is TimeoutCancellationException -> source.addGroup("校验超时") |
|
|
|
//NoStackTraceException 已经添加了分组,其余的视为规则失效 |
|
|
|
is ScriptException, is WrappedException -> source.addGroup("js失效") |
|
|
|
!is NoStackTraceException -> source.addGroup("规则失效") |
|
|
|
!is NoStackTraceException -> source.addGroup("网站失效") |
|
|
|
} |
|
|
|
} |
|
|
|
source.bookSourceComment = |
|
|
|
source.bookSourceComment = |
|
|
|
"Error: ${it.localizedMessage}" + if (source.bookSourceComment.isNullOrBlank()) |
|
|
|
"Error: ${it.localizedMessage}" + if (source.bookSourceComment.isNullOrBlank()) |
|
|
|
"" else "\n\n${source.bookSourceComment}" |
|
|
|
"" else "\n\n${source.bookSourceComment}" |
|
|
|
Debug.updateFinalMessage(source.bookSourceUrl, "校验失败:${it.localizedMessage}") |
|
|
|
Debug.updateFinalMessage(source.bookSourceUrl, "校验失败:${it.localizedMessage}") |
|
|
|
}.onSuccess(searchCoroutine) { |
|
|
|
}.onSuccess(searchCoroutine) { |
|
|
|
source.removeGroup("失效") |
|
|
|
|
|
|
|
source.removeGroup("规则失效") |
|
|
|
|
|
|
|
source.removeGroup("校验超时") |
|
|
|
source.removeGroup("校验超时") |
|
|
|
Debug.updateFinalMessage(source.bookSourceUrl, "校验成功") |
|
|
|
Debug.updateFinalMessage(source.bookSourceUrl, "校验成功") |
|
|
|
}.onFinally(IO) { |
|
|
|
}.onFinally(IO) { |
|
|
@ -230,7 +229,6 @@ class CheckSourceService : BaseService() { |
|
|
|
when (it) { |
|
|
|
when (it) { |
|
|
|
is ContentEmptyException -> source.addGroup("${bookType}正文失效") |
|
|
|
is ContentEmptyException -> source.addGroup("${bookType}正文失效") |
|
|
|
is TocEmptyException -> source.addGroup("${bookType}目录失效") |
|
|
|
is TocEmptyException -> source.addGroup("${bookType}目录失效") |
|
|
|
//超时 网站异常 源码改变 |
|
|
|
|
|
|
|
else -> throw it |
|
|
|
else -> throw it |
|
|
|
} |
|
|
|
} |
|
|
|
}.onSuccess { |
|
|
|
}.onSuccess { |
|
|
|