-
This commit is contained in:
parent
382a1873d7
commit
9d33b9f003
5
utils.py
5
utils.py
@ -42,9 +42,7 @@ def check_allocation_thread_function():
|
|||||||
while True:
|
while True:
|
||||||
ids = db.get_image_allocation_all()
|
ids = db.get_image_allocation_all()
|
||||||
for x in ids:
|
for x in ids:
|
||||||
print(x)
|
|
||||||
ip = db.get_image_allocation_clientip_id_vpn(x[0])
|
ip = db.get_image_allocation_clientip_id_vpn(x[0])
|
||||||
print(x[0], ip)
|
|
||||||
ping_thread = PingThread(ip, x[0])
|
ping_thread = PingThread(ip, x[0])
|
||||||
ping_thread.start()
|
ping_thread.start()
|
||||||
|
|
||||||
@ -58,13 +56,16 @@ class PingThread(threading.Thread):
|
|||||||
self.Id = id
|
self.Id = id
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
print(self.Ip, self.Id)
|
||||||
if self.Ip is None:
|
if self.Ip is None:
|
||||||
return
|
return
|
||||||
if ping_client(self.Ip) == False:
|
if ping_client(self.Ip) == False:
|
||||||
date = db.get_image_allocation_time_id(self.Id)
|
date = db.get_image_allocation_time_id(self.Id)
|
||||||
|
print(date)
|
||||||
if date is None:
|
if date is None:
|
||||||
return
|
return
|
||||||
delta = datetime.datetime.now() - date
|
delta = datetime.datetime.now() - date
|
||||||
|
print(delta)
|
||||||
if delta.total_seconds() > 30:
|
if delta.total_seconds() > 30:
|
||||||
db.del_image_allocation_id(self.Id)
|
db.del_image_allocation_id(self.Id)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user