keep going when the connection to the vending machine is lost
authorCameron Patrick <[email protected]>
Sat, 31 Jul 2004 10:38:07 +0000 (10:38 +0000)
committerCameron Patrick <[email protected]>
Sat, 31 Jul 2004 10:38:07 +0000 (10:38 +0000)
sql-edition/servers/VendServer.py

index a2cdfba..ff17122 100755 (executable)
@@ -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..."
+

UCC git Repository :: git.ucc.asn.au