WebSocket接続がProtocolExceptionを出した際のログ出力を短くする

This commit is contained in:
tateisu 2023-08-17 10:13:43 +09:00
parent 687e48a5a3
commit ea89672d18
1 changed files with 7 additions and 5 deletions

View File

@ -78,6 +78,8 @@ class StreamConnection(
// Misskeyの投稿キャプチャ // Misskeyの投稿キャプチャ
private val capturedId = HashSet<EntityId>() private val capturedId = HashSet<EntityId>()
private var lastUrl = "?"
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
// methods // methods
@ -375,17 +377,16 @@ class StreamConnection(
manager.enqueue { manager.enqueue {
if (t is SocketException && t.message?.contains("closed") == true) { if (t is SocketException && t.message?.contains("closed") == true) {
log.v("$name socket closed.") log.v("$name socket closed.")
} else { } else if (t is ProtocolException) {
log.w(t, "$name WebSocket onFailure.") log.w(t.withCaption("$name WebSocket onFailure.") + " " + lastUrl)
}
if (t is ProtocolException) {
val msg = t.message val msg = t.message
if (msg != null && reAuthorizeError.matcher(msg).find()) { if (msg != null && reAuthorizeError.matcher(msg).find()) {
log.w("$name seems this server don't support public TL streaming. don't retry…") log.w("$name seems this server don't support public TL streaming. don't retry…")
status = StreamStatus.ClosedNoRetry status = StreamStatus.ClosedNoRetry
return@enqueue return@enqueue
} }
} else {
log.w(t, "$name WebSocket onFailure.")
} }
setStatusClose() setStatusClose()
@ -552,6 +553,7 @@ class StreamConnection(
} }
val url = "$prefix$path" val url = "$prefix$path"
this.lastUrl = url
val (result, ws) = try { val (result, ws) = try {
log.i("webSocket $url") log.i("webSocket $url")