Fix publishing the onion - supposed to be done every 4 hours
This commit is contained in:
parent
54172c6972
commit
aa71673320
|
@ -25,8 +25,12 @@ class Manager(threading.Thread):
|
||||||
self.last_pickled_objects = time.time()
|
self.last_pickled_objects = time.time()
|
||||||
self.last_pickled_nodes = time.time()
|
self.last_pickled_nodes = time.time()
|
||||||
# Publish destination 5-15 minutes after start
|
# Publish destination 5-15 minutes after start
|
||||||
self.last_published_destination = \
|
self.last_published_i2p_destination = \
|
||||||
time.time() - 50 * 60 + random.uniform(-1, 1) * 300 # nosec B311
|
time.time() - 50 * 60 + random.uniform(-1, 1) * 300 # nosec B311
|
||||||
|
# Publish onion 4-8 min later
|
||||||
|
self.last_published_onion_peer = \
|
||||||
|
self.last_published_i2p_destination - 3 * 3600 + \
|
||||||
|
random.uniform(1, 2) * 240 # nosec B311
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.load_data()
|
self.load_data()
|
||||||
|
@ -49,10 +53,12 @@ class Manager(threading.Thread):
|
||||||
if now - self.last_pickled_nodes > 60:
|
if now - self.last_pickled_nodes > 60:
|
||||||
self.pickle_nodes()
|
self.pickle_nodes()
|
||||||
self.last_pickled_nodes = now
|
self.last_pickled_nodes = now
|
||||||
if now - self.last_published_destination > 3600:
|
if now - self.last_published_i2p_destination > 3600:
|
||||||
self.publish_i2p_destination()
|
self.publish_i2p_destination()
|
||||||
|
self.last_published_i2p_destination = now
|
||||||
|
if now - self.last_published_onion_peer > 3600 * 4:
|
||||||
self.publish_onion_peer()
|
self.publish_onion_peer()
|
||||||
self.last_published_destination = now
|
self.last_published_onion_peer = now
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def clean_objects():
|
def clean_objects():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user