mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-10-10 13:53:17 +02:00
calculate wot less frenquently
This commit is contained in:
@@ -42,6 +42,7 @@ class DicoverContentDBUpdateScheduler(DVMTaskInterface):
|
|||||||
personalized = False
|
personalized = False
|
||||||
result = ""
|
result = ""
|
||||||
database = None
|
database = None
|
||||||
|
wot_counter = 0
|
||||||
|
|
||||||
async def init_dvm(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None,
|
async def init_dvm(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None,
|
||||||
admin_config: AdminConfig = None, options=None):
|
admin_config: AdminConfig = None, options=None):
|
||||||
@@ -144,7 +145,7 @@ class DicoverContentDBUpdateScheduler(DVMTaskInterface):
|
|||||||
|
|
||||||
await cli.connect()
|
await cli.connect()
|
||||||
|
|
||||||
if self.dvm_config.WOT_FILTERING:
|
if self.dvm_config.WOT_FILTERING and self.wot_counter == 0:
|
||||||
print("Calculating WOT for " + str(self.dvm_config.WOT_BASED_ON_NPUBS))
|
print("Calculating WOT for " + str(self.dvm_config.WOT_BASED_ON_NPUBS))
|
||||||
filtering = cli.filtering()
|
filtering = cli.filtering()
|
||||||
index_map, G = await build_wot_network(self.dvm_config.WOT_BASED_ON_NPUBS,
|
index_map, G = await build_wot_network(self.dvm_config.WOT_BASED_ON_NPUBS,
|
||||||
@@ -166,7 +167,11 @@ class DicoverContentDBUpdateScheduler(DVMTaskInterface):
|
|||||||
# toc = time.time()
|
# toc = time.time()
|
||||||
# print(f'finished in {toc - tic} seconds')
|
# print(f'finished in {toc - tic} seconds')
|
||||||
await filtering.add_public_keys(wot_keys)
|
await filtering.add_public_keys(wot_keys)
|
||||||
|
self.wot_calculated = True
|
||||||
|
self.wot_counter += 1
|
||||||
|
# only calculate wot every 10th call
|
||||||
|
if self.wot_counter >= 10:
|
||||||
|
self.wot_counter = 0
|
||||||
# Mute public key
|
# Mute public key
|
||||||
# await cli. (self.dvm_config.MUTE)
|
# await cli. (self.dvm_config.MUTE)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user