From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,NO_DNS_FOR_FROM, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from [10.7.7.5] (unknown [182.253.183.184]) by gnuweeb.org (Postfix) with ESMTPSA id 19A0A7E3B8; Tue, 3 Jan 2023 07:19:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1672730368; bh=aMi/SNHBzgrweFug4N/8B0VmyBQ7G82LaS/NL7MQp9w=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=k3dEKmxYdjVuZ5YTsfO0GjbR0lTD1/TYu/+L/R+D0JZ1bhOYYL7WX9WUw1jRuvR+m YQwbs3bgoW4lfmDqoWq5YBPIOI7P0V/KuqAId+98wXwTOBnRyi0Ue0hpy1VLw4CZVA qsgyzhfMMtN6MjieLgmLUPfZASsOleI5kJfNnmq+u51Oav/j4CZzBJ8xsYc+80hIM7 sSSgaLh3Gfm2FR4Tq4zDCCS9eQVMlHdT/ak/TVoz6qV17zTfWHIK9KVKeOIRRvqZOW 93PbWmNPrCwg/vp+kUcJv4sjC6Nj1PWEB+2Ic5kROpfiQd1gdPD3Nct4tRRYMOHans VWBEHf11lbzCg== Message-ID: <9dfe7cd4-9f26-e199-327b-d64b1862038e@gnuweeb.org> Date: Tue, 3 Jan 2023 14:19:24 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v1 11/13] feat(discord): Handle MySQL connection error in the mail listener Content-Language: en-US To: Muhammad Rizki Cc: Alviro Iskandar Setiawan , GNU/Weeb Mailing List References: <20230103063641.1680-1-kiizuha@gnuweeb.org> <20230103063641.1680-12-kiizuha@gnuweeb.org> From: Ammar Faizi In-Reply-To: <20230103063641.1680-12-kiizuha@gnuweeb.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: On 1/3/23 1:36 PM, Muhammad Rizki wrote: > diff --git a/daemon/dscord/mailer/listener.py b/daemon/dscord/mailer/listener.py > index ec58f6a..2bde0f0 100644 > --- a/daemon/dscord/mailer/listener.py > +++ b/daemon/dscord/mailer/listener.py > @@ -6,6 +6,7 @@ > > import asyncio > import re > +from mysql.connector.errors import OperationalError, DatabaseError > from apscheduler.schedulers.asyncio import AsyncIOScheduler > from discord import File > from discord import Message > @@ -74,6 +75,8 @@ class Listener: > try: > for url in self.db.get_atom_urls(): > await self.__handle_atom_url(url) > + except (OperationalError, DatabaseError) as e: > + await self.handle_db_error(e) This is trivial and still very relevant with patch #10, please squash this into patch #10. -- Ammar Faizi