Take abou half minute doing hundries "peewee: ('SELECT "t1"."id", "t1"."sender_key", "t1"."session_id" ..." when send a simple message.
- Lingua principale
- Python
- Stelle
- 754
- Fork
- 69
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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 ?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python, sql, sqlite
- Ambito
- cli, databases, performance
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100