diff --git a/app.py b/app.py index b3aa767..9a6848b 100644 --- a/app.py +++ b/app.py @@ -78,19 +78,20 @@ def main(): # Test ip change stuff - current_ip = r.get('current_ip') + old_ip = r.get('current_ip') - if current_ip: - current_ip = current_ip.decode('utf-8') + if old_ip: + old_ip = old_ip.decode('utf-8') - if not current_ip: # Not set yet. I this case no update required - current_ip = socket.gethostbyname(host_name) + current_ip = socket.gethostbyname(host_name) + + + if not old_ip: # Not set yet. I this case no update required r.set('current_ip', current_ip.encode('utf-8')) logging.debug(f"Previous info about the ip address could not be found! Current: {current_ip}") - elif current_ip != socket.gethostbyname(host_name): - logging.info(f'IP changed: {current_ip} Pushing updates...') - current_ip = socket.gethostbyname(host_name) + elif old_ip != current_ip: + logging.info(f'IP changed: {old_ip} -> {current_ip} Pushing updates...') r.set('current_ip', current_ip.encode('utf-8')) # pushing updates...