option to disable sync for profile dvms

This commit is contained in:
Believethehype 2024-11-05 10:03:28 +01:00
parent fe46b4b4c7
commit bbc4b7a04f
2 changed files with 8 additions and 4 deletions

View File

@ -31,7 +31,8 @@ class DiscoveryBotFarms(DVMTaskInterface):
async def init_dvm(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None,
admin_config: AdminConfig = None, options=None):
dvm_config.SCRIPT = os.path.abspath(__file__)
await self.sync_db()
if self.dvm_config.UPDATE_DATABASE:
await self.sync_db()
async def is_input_supported(self, tags, client=None, dvm_config=None):
for tag in tags:
@ -129,7 +130,8 @@ class DiscoveryBotFarms(DVMTaskInterface):
return 0
else:
if Timestamp.now().as_secs() >= self.last_schedule + dvm_config.SCHEDULE_UPDATES_SECONDS:
await self.sync_db()
if self.dvm_config.UPDATE_DATABASE:
await self.sync_db()
self.last_schedule = Timestamp.now().as_secs()
return 1

View File

@ -35,7 +35,8 @@ class SearchUser(DVMTaskInterface):
dvm_config.SCRIPT = os.path.abspath(__file__)
if self.options.get("relay"):
self.relay = self.options['relay']
await self.sync_db()
if self.dvm_config.UPDATE_DATABASE:
await self.sync_db()
async def is_input_supported(self, tags, client=None, dvm_config=None):
for tag in tags:
@ -133,7 +134,8 @@ class SearchUser(DVMTaskInterface):
return 0
else:
if Timestamp.now().as_secs() >= self.last_schedule + dvm_config.SCHEDULE_UPDATES_SECONDS:
await self.sync_db()
if self.dvm_config.UPDATE_DATABASE:
await self.sync_db()
self.last_schedule = Timestamp.now().as_secs()
return 1