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-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=38263c3d95b992be7e9fd6a266b0fd69aead7002;p=zanchey%2Fdispense2.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..." +