anoadragon453 / matrix-reminder-bot

A bot to remind you about stuff. Supports encrypted rooms
Apache License 2.0
52 stars 20 forks source link

Reconnect to psql when connection lost #153

Open HarHarLinks opened 9 months ago

HarHarLinks commented 9 months ago
2024-02-12 10:13:33,777 | matrix_reminder_bot.callbacks [ERROR] Unknown error while processing command:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/callbacks.py", line 113, in message
    await command.process()
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/bot_commands.py", line 305, in process
    await self._remind_me()
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/functions.py", line 99, in inner
    await command_func(self, *args, **kwargs)
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/bot_commands.py", line 339, in _remind_me
    await self._remind(target=self.event.sender)
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/bot_commands.py", line 297, in _remind
    self.store.store_reminder(reminder)
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/storage.py", line 359, in store_reminder
    self._execute(
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/storage.py", line 71, in _execute
    self.cursor.execute(args[0].replace("?", "%s"), *args[1:])
psycopg2.OperationalError: server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.

2024-02-12 10:14:04,152 | matrix_reminder_bot.callbacks [ERROR] Unknown error while processing command:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/callbacks.py", line 113, in message
    await command.process()
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/bot_commands.py", line 330, in process
    await self._delete_reminder()
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/functions.py", line 99, in inner
    await command_func(self, *args, **kwargs)
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/bot_commands.py", line 530, in _delete_reminder
    reminder.cancel()
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/reminder.py", line 181, in cancel
    self.store.delete_reminder(self.room_id, self.reminder_text)
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/storage.py", line 388, in delete_reminder
    self._execute(
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/storage.py", line 71, in _execute
    self.cursor.execute(args[0].replace("?", "%s"), *args[1:])
psycopg2.InterfaceError: cursor already closed
2024-02-12 10:15:00,555 | apscheduler.executors.default [ERROR] Job "Reminder._fire (trigger: date[2024-02-12 10:15:00 CET], next run at: 2024-02-12 10:15:00 CET)" raised an exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
    retval = await job.func(*job.args, **job.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/reminder.py", line 145, in _fire
    self.cancel(cancel_alarm=False)
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/reminder.py", line 181, in cancel
    self.store.delete_reminder(self.room_id, self.reminder_text)
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/storage.py", line 388, in delete_reminder
    self._execute(
  File "/usr/local/lib/python3.11/site-packages/matrix_reminder_bot/storage.py", line 71, in _execute
    self.cursor.execute(args[0].replace("?", "%s"), *args[1:])
psycopg2.InterfaceError: cursor already closed