public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH v1 0/2] Automatic recovery from a MySQL restart
@ 2022-10-27 15:08 Ammar Faizi
  2022-10-27 15:08 ` [PATCH v1 1/2] daemon: telegram: db: Allow the caller to reconnect Ammar Faizi
  2022-10-27 15:08 ` [PATCH v1 2/2] daemon: telegram: Handle MySQL error Ammar Faizi
  0 siblings, 2 replies; 42+ messages in thread
From: Ammar Faizi @ 2022-10-27 15:08 UTC (permalink / raw)
  To: GNU/Weeb Mailing List
  Cc: Ammar Faizi, Muhammad Rizki, Alviro Iskandar Setiawan

Hi,

This series adds a mechanism for the daemon to recover from a MySQL
restart event. Currently, the daemon is totally unusable when the MySQL
server is restarted. It's spinning in a loop with the following error:

   mysql.connector.errors.OperationalError: 2013 (HY000): Lost connection to MySQL server during query

When it happens, the only way to fix the situation is: restart the
daemon manually, which is obviously not productive. Create a mechanism
in the class DB to allow the caller to reconnect. This way, the caller
can automatically reconnect without having the user restart the daemon.

Handle MySQL error in the main daemon loop path. Do reconnect to the
database if such an error happens. This way, the daemon can
automatically recover from the MySQL server restart without having the
user restart the daemon.

This series is just a hot fix, there are two patches in this series:

  - Patch 1 is a preparation patch to create a recover mechanism.
  - Patch 2 is to implement the recover mechanism in the main daemon
    loop path.

Signed-off-by: Ammar Faizi <[email protected]>
---

Ammar Faizi (2):
  daemon: telegram: db: Allow the caller to reconnect
  daemon: telegram: Handle MySQL error

 daemon/telegram/database/core.py   | 31 +++++++++++++++++++++++++-----
 daemon/telegram/mailer/listener.py | 29 ++++++++++++++++++++++++----
 daemon/telegram/packages/client.py |  8 ++++----
 daemon/tg.py                       |  4 ++--
 4 files changed, 57 insertions(+), 15 deletions(-)


base-commit: 6e94cf607287e5bc209e9c14c8156c7ad49455e3
-- 
Ammar Faizi


^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2022-10-28 19:55 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-27 15:08 [PATCH v1 0/2] Automatic recovery from a MySQL restart Ammar Faizi
2022-10-27 15:08 ` [PATCH v1 1/2] daemon: telegram: db: Allow the caller to reconnect Ammar Faizi
2022-10-27 16:52   ` Muhammad Rizki
2022-10-27 16:54     ` Muhammad Rizki
2022-10-28  5:48       ` Ammar Faizi
2022-10-27 15:08 ` [PATCH v1 2/2] daemon: telegram: Handle MySQL error Ammar Faizi
2022-10-28  9:21   ` Alviro Iskandar Setiawan
2022-10-28  9:28     ` Ammar Faizi
2022-10-28  9:24   ` Alviro Iskandar Setiawan
2022-10-28  9:32     ` Ammar Faizi
2022-10-28  9:40       ` Alviro Iskandar Setiawan
2022-10-28  9:43         ` Ammar Faizi
2022-10-28 16:29           ` Ammar Faizi
2022-10-28 16:46             ` Alviro Iskandar Setiawan
2022-10-28 16:54               ` Ammar Faizi
2022-10-28 18:10               ` Muhammad Rizki
2022-10-28 18:26                 ` Alviro Iskandar Setiawan
2022-10-28 18:52                   ` Muhammad Rizki
2022-10-28 19:08                     ` Alviro Iskandar Setiawan
2022-10-28 19:15                       ` Muhammad Rizki
2022-10-28 19:29                         ` Alviro Iskandar Setiawan
2022-10-28 19:34                           ` Ammar Faizi
2022-10-28 19:36                             ` Ammar Faizi
2022-10-28 19:38                               ` Ammar Faizi
2022-10-28 19:44                                 ` Muhammad Rizki
2022-10-28 19:39                           ` Muhammad Rizki
2022-10-28 19:44                             ` Alviro Iskandar Setiawan
2022-10-28 19:46                               ` Muhammad Rizki
2022-10-28 19:53                                 ` Alviro Iskandar Setiawan
2022-10-28 19:16                     ` Ammar Faizi
2022-10-28 19:19                       ` Muhammad Rizki
2022-10-28 19:19                         ` Ammar Faizi
2022-10-28 19:22                           ` Muhammad Rizki
2022-10-28 19:33                             ` Ammar Faizi
2022-10-28 19:38                               ` Muhammad Rizki
2022-10-28 17:02             ` Muhammad Rizki
2022-10-28 17:19               ` Ammar Faizi
2022-10-28 18:15                 ` Muhammad Rizki
2022-10-28 18:18                   ` Muhammad Rizki
2022-10-28 19:49                     ` Ammar Faizi
2022-10-28 19:55                       ` Muhammad Rizki
2022-10-28 19:46                   ` Ammar Faizi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox