mirror of https://github.com/CIRCL/AIL-framework
fix: [D4] fix module cache
parent
5fab2326e6
commit
e4f21f05cc
|
@ -34,16 +34,20 @@ class D4Client(AbstractModule):
|
||||||
|
|
||||||
self.d4_client = d4.create_d4_client()
|
self.d4_client = d4.create_d4_client()
|
||||||
self.last_refresh = time.time()
|
self.last_refresh = time.time()
|
||||||
|
self.last_config_check = time.time()
|
||||||
|
|
||||||
# Send module state to logs
|
# Send module state to logs
|
||||||
self.logger.info(f'Module {self.module_name} initialized')
|
self.logger.info(f'Module {self.module_name} initialized')
|
||||||
|
|
||||||
def compute(self, dns_record):
|
def compute(self, dns_record):
|
||||||
# Refresh D4 Client
|
# Refresh D4 Client
|
||||||
if self.last_refresh < d4.get_config_last_update_time():
|
if self.last_config_check < int(time.time()) - 30:
|
||||||
self.d4_client = d4.create_d4_client()
|
print('refresh rrrr')
|
||||||
self.last_refresh = time.time()
|
if self.last_refresh < d4.get_config_last_update_time():
|
||||||
print('D4 Client: config updated')
|
self.d4_client = d4.create_d4_client()
|
||||||
|
self.last_refresh = time.time()
|
||||||
|
print('D4 Client: config updated')
|
||||||
|
self.last_config_check = time.time()
|
||||||
|
|
||||||
if self.d4_client:
|
if self.d4_client:
|
||||||
# Send DNS Record to D4Server
|
# Send DNS Record to D4Server
|
||||||
|
|
Loading…
Reference in New Issue