File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 44
55import timeago
66from peewee import PostgresqlDatabase , SqliteDatabase , ProgrammingError
7+ from playhouse .shortcuts import ReconnectMixin
78from aiocryptocurrency .coins import Coin , SUPPORTED_COINS
89from aiocryptocurrency .coins .nero import Wownero , Monero
910from aiocryptocurrency .coins .firo import Firo
2728discourse = Discourse ()
2829proposal_task = None
2930
30- database = PostgresqlDatabase (
31+
32+ class ReconnectingPGDatabase (ReconnectMixin , PostgresqlDatabase ):
33+ def __init__ (self , * args , ** kwargs ):
34+ import peewee as pw
35+ super (ReconnectingPGDatabase , self ).__init__ (* args , ** kwargs )
36+ self ._reconnect_errors = {
37+ pw .InterfaceError : ["connection already closed" ]
38+ }
39+
40+
41+ database = ReconnectingPGDatabase (
3142 settings .DB_NAME ,
3243 autorollback = True ,
3344 user = settings .DB_USER ,
You can’t perform that action at this time.
0 commit comments