SubwayTooter icon indicating copy to clipboard operation
SubwayTooter copied to clipboard

SubwayTooterはMisskeyのi/notificationsエンドポイントを無限にリクエストします

Open tamaina opened this issue 3 years ago • 8 comments

SubwayTooterがMisskeyのi/notificationsエンドポイントを無限に叩こうとするため、Misskeyインスタンスの負荷を極端に高めています。

MisskeyのAPI制限が緩いのも問題なのですが、SubwayTooterにおいてもご対応いただきたくお願い致します。

tamaina avatar Jun 14 '22 06:06 tamaina

https://github.com/tateisu/SubwayTooter/releases/tag/v4.9.0

tateisu avatar Jun 14 '22 06:06 tateisu

Misskey 12.111.1 と Subway Tooter 4.9.2 でこの問題は解決しないようです:

[26/Jun/2022:12:57:57 +0200] "POST http://borg.social/api/i/notifications HTTP/1.1" 200 25353 "-" "SubwayTooter/4.9.2 Android/12"
[26/Jun/2022:12:57:59 +0200] "POST http://borg.social/api/i/notifications HTTP/1.1" 200 25353 "-" "SubwayTooter/4.9.2 Android/12"
[26/Jun/2022:12:58:01 +0200] "POST http://borg.social/api/i/notifications HTTP/1.1" 200 25353 "-" "SubwayTooter/4.9.2 Android/12"
[26/Jun/2022:12:58:03 +0200] "POST http://borg.social/api/i/notifications HTTP/1.1" 200 25353 "-" "SubwayTooter/4.9.2 Android/12"
[26/Jun/2022:12:58:05 +0200] "POST http://borg.social/api/i/notifications HTTP/1.1" 200 25353 "-" "SubwayTooter/4.9.2 Android/12"
[26/Jun/2022:12:58:07 +0200] "POST http://borg.social/api/i/notifications HTTP/1.1" 200 25353 "-" "SubwayTooter/4.9.2 Android/12"
[26/Jun/2022:12:58:09 +0200] "POST http://borg.social/api/i/notifications HTTP/1.1" 200 25353 "-" "SubwayTooter/4.9.2 Android/12"
[26/Jun/2022:12:58:12 +0200] "POST http://borg.social/api/i/notifications HTTP/1.1" 200 25353 "-" "SubwayTooter/4.9.2 Android/12"
[26/Jun/2022:12:58:14 +0200] "POST http://borg.social/api/i/notifications HTTP/1.1" 200 25353 "-" "SubwayTooter/4.9.2 Android/12"
[26/Jun/2022:12:58:16 +0200] "POST http://borg.social/api/i/notifications HTTP/1.1" 200 25353 "-" "SubwayTooter/4.9.2 Android/12"
[26/Jun/2022:12:58:19 +0200] "POST http://borg.social/api/i/notifications HTTP/1.1" 429 157 "-" "SubwayTooter/4.9.2 Android/12"

機械翻訳を使用しているため、スペルミスがある場合はご容赦ください。

nvisser avatar Jun 26 '22 11:06 nvisser

I couldn't fix this problem well because I didn't saw it myself. I think it's probably due to my Misskey usage pattern.

In version 4.9.3, SubwayTooter no longer checks notifications to Misskey servers by default. It is possible to return to the original behavior by changing the application settings, but the setting item clearly states that it is unstable.

tateisu avatar Jul 07 '22 14:07 tateisu

I guess it can't be helped, thank you for looking into it.

nvisser avatar Jul 07 '22 14:07 nvisser

https://github.com/misskey-dev/misskey/issues/8906#issuecomment-1177921071 にコメントしましたが、

  • (A) STはPushメッセージを受け取ると通知APIにアクセスする
  • (B) Misskeyは通知APIにアクセスするとPushメッセージを出すようになった

というのが今回の問題の真相です。(B)が出すPushメッセージは本当に必要なものなのでしょうか。たとえば未読位置が実際には変化していないのに「未読を更新しました」など送ってたりしませんか。 @tamaina

tateisu avatar Jul 07 '22 17:07 tateisu

https://github.com/tateisu/SubwayTooter/releases/tag/v4.9.4

tateisu avatar Jul 07 '22 22:07 tateisu

4.9.4で行った変更の動作確認。

自宅鯖にログ出力を追加して

--- a/packages/backend/src/server/api/endpoints/i/notifications.ts
+++ b/packages/backend/src/server/api/endpoints/i/notifications.ts
@@ -115,6 +115,7 @@ export default define(meta, paramDef, async (ps, user) => {
        const notifications = await query.take(ps.limit).getMany();

        // Mark all as read
+       console.log(`markAsRead=${ps.markAsRead}`);
        if (notifications.length > 0 && ps.markAsRead) {
                readNotification(user.id, notifications.map(x => x.id));
        }

ST 4.9.4 のバックグラウンド通知チェック時に markAsRead=falseが設定されていることは確認した

$ docker-compose logs -f | grep markAsRead
web_1    | markAsRead=true
web_1    | markAsRead=true
web_1    | markAsRead=false

とりあえずパラメータ指定ミスとかはないことがわかった。

しかしこのサーバだとなぜかプッシュ通知を発生させることができていないし、そもそも私の手元では肝心の問題を再現できていない。

tateisu avatar Jul 08 '22 22:07 tateisu

https://github.com/misskey-dev/misskey/pull/8979 が入ったリリースが普及したら通知チェックを再び有効にする

tateisu avatar Jul 24 '22 14:07 tateisu

c0966845b0973ea20c2982256f0cc86c88346409 で通知チェックをONに戻した

tateisu avatar Jan 13 '23 04:01 tateisu

https://github.com/tateisu/SubwayTooter/releases/tag/v5.0.8

tateisu avatar Jan 13 '23 07:01 tateisu