8go / 8go/matrix-commander

Take abou half minute doing hundries "peewee: ('SELECT "t1"."id", "t1"."sender_key", "t1"."session_id" ..." when send a simple message.

オープン
#176 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
754
フォーク
69
PR マージ指標
30日以内にマージされた PR はありません

説明

I have a matrix synapse server 1.106.0 and this server is private only without federation.

I managed to use matrix-commander (7.6.1 2024-05-02) to send messages to an encrypted DM room. But the matrix-commander takes about half minute to complete.

The command I use is
```
matrix-commander --sync OFF --log-level DEBUG DEBUG --message "Good Day :)"
```
The option `--log-level DEBUG DEBUG` is for debug only and then I got hundries `peewee: ('SELECT "t1"."id", "t1"."sender_key", "t1"."session_id"...` logs. And these took about **30 seconds**.
```
2024-05-07 19:16:09,325: DEBUG: matrix-commander: Log level is set for module matrix-commander. log_level=DEBUG
2024-05-07 19:16:09,325: DEBUG: matrix-commander: Log level is set for modules below matrix-commander. log_level=DEBUG
...
2024-05-07 19:16:09,333: DEBUG: peewee: ('CREATE TABLE IF NOT EXISTS "storeversion" ("id" INTEGER NOT NULL PRIMARY KEY, "version" INTEGER NOT NULL)', [])
...
2024-05-07 19:16:09,437: DEBUG: peewee: ('SELECT "t1"."id", "t1"."sender_key", "t1"."session_id" FROM "forwardedchains" AS "t1" WHERE ("t1"."session_id" = ?)', ['c2comCGfhqgeTX/eJuhs=======sTEcS7E4GHE8K2yk'])
(repeat hundries with different tail base64 text)
2024-05-07 19:16:36,352: DEBUG: peewee: ('SELECT "t1"."id", "t1"."sender_key", "t1"."session_id" FROM "forwardedchains" AS "t1" WHERE ("t1"."session_id" = ?)', ['9LlsmEmQbelAAkvpPB=======YsqIFzr3JSWu3eDNsw'])
2024-05-07 19:16:36,374: DEBUG: peewee: ('SELECT "t1"."id", "t1"."account", "t1"."user_id", "t1"."device_id", "t1"."shared" FROM "accounts" AS "t1" WHERE (("t1"."user_id" = ?) AND ("t1"."device_id" = ?)) LIMIT ? OFFSET ?', ['@SOMEONE:SERVER', 'NT=======A', 1, 0])
2024-05-07 19:16:36,376: DEBUG: peewee: ('SELECT "t1"."id", "t1"."device_id", "t1"."user_id", "t1"."display_name", "t1"."deleted", "t1"."account_id" FROM "devicekeys" AS "t1" WHERE ("t1"."account_id" = ?)', [1])
2024-05-07 19:16:36,378: DEBUG: peewee: ('SELECT "t1"."id", "t1"."key_type", "t1"."key", "t1"."device_id" FROM "keys" AS "t1" WHERE ("t1"."device_id" = ?)', [1])
...
2024-05-07 19:16:36,771: DEBUG: peewee: ('SELECT "t1"."id", "t1"."key_type", "t1"."key", "t1"."device_id" FROM "keys" AS "t1" WHERE ("t1"."device_id" = ?)', [206])
...
```
How can I avoid this problem ?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

The issue shows repeated peewee SQL queries on tables like forwardedchains, accounts, devicekeys, and keys, causing a 30-second delay. Start by examining the database layer in matrix-commander, likely using SQLite via peewee ORM. Look for the code that handles session lookups or key management, and check if there's an inefficient loop or missing index. Run the command with debug logging to see the exact queries and profile the database calls.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python, sql, sqlite
領域
cli, databases, performance
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。