From: Cameron Patrick Date: Sat, 31 Jul 2004 10:38:07 +0000 (+0000) Subject: keep going when the connection to the vending machine is lost X-Git-Tag: IMPORT-FROM-UCCCVS~113 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=96f83cc17e02d3c425dbafb91d01a130fecece12;p=uccvend-vendserver.git keep going when the connection to the vending machine is lost --- diff --git a/sql-edition/servers/VendServer.py b/sql-edition/servers/VendServer.py index a2cdfba..ff17122 100755 --- a/sql-edition/servers/VendServer.py +++ b/sql-edition/servers/VendServer.py @@ -400,6 +400,11 @@ if __name__ == '__main__': ServiceName = cp.get('VendingMachine', 'ServiceName') ServicePassword = cp.get('VendingMachine', 'Password') - - rfh, wfh = connect_to_vend(options, DBServer, DBName, DBUser, DBPassword, ServiceName, ServicePassword) - run_forever(rfh, wfh) + + while True: + rfh, wfh = connect_to_vend(options, DBServer, DBName, DBUser, DBPassword, ServiceName, ServicePassword) + try: + run_forever(rfh, wfh) + except VendingException: + print "Connection died, trying again..." +