From 15517732aed696f99cf96ff49502d21feb61beb3 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Thu, 16 Mar 2017 17:48:28 -0400 Subject: [PATCH] add config to disable reflecting on publish --- CHANGELOG.md | 1 + lbrynet/conf.py | 2 +- lbrynet/lbryfilemanager/EncryptedFileManager.py | 4 +++- lbrynet/lbrynet_daemon/Daemon.py | 7 ++++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6ae1468b..99d7cb0f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ at anytime. ## [Unreleased] ### Added * publish API command can take metadata fields as arguments + * Added `reflect_uploads` config to disable reflecting on upload * * diff --git a/lbrynet/conf.py b/lbrynet/conf.py index 76ac1623a..1dc2b6b3c 100644 --- a/lbrynet/conf.py +++ b/lbrynet/conf.py @@ -192,7 +192,7 @@ ADJUSTABLE_SETTINGS = { 'peer_port': (int, 3333), 'pointtrader_server': (str, 'http://127.0.0.1:2424'), 'reflector_port': (int, 5566), - 'reflector_reupload': (bool, True), + 'reflect_uploads': (bool, True), 'reflector_servers': (list, [('reflector.lbry.io', 5566)], server_port), 'run_on_startup': (bool, False), 'run_reflector_server': (bool, False), diff --git a/lbrynet/lbryfilemanager/EncryptedFileManager.py b/lbrynet/lbryfilemanager/EncryptedFileManager.py index a6a68a11c..4dbf3dd60 100644 --- a/lbrynet/lbryfilemanager/EncryptedFileManager.py +++ b/lbrynet/lbryfilemanager/EncryptedFileManager.py @@ -17,6 +17,7 @@ from lbrynet.lbryfile.StreamDescriptor import EncryptedFileStreamType from lbrynet.cryptstream.client.CryptStreamDownloader import AlreadyStoppedError from lbrynet.cryptstream.client.CryptStreamDownloader import CurrentlyStoppingError from lbrynet.core.sqlite_helpers import rerun_if_locked +from lbrynet.conf import settings log = logging.getLogger(__name__) @@ -57,7 +58,8 @@ class EncryptedFileManager(object): yield self._open_db() yield self._add_to_sd_identifier() yield self._start_lbry_files() - safe_start_looping_call(self.lbry_file_reflector) + if settings['reflect_uploads']: + safe_start_looping_call(self.lbry_file_reflector) def get_lbry_file_status(self, lbry_file): return self._get_lbry_file_status(lbry_file.rowid) diff --git a/lbrynet/lbrynet_daemon/Daemon.py b/lbrynet/lbrynet_daemon/Daemon.py index 881fe55ae..34d81ea4f 100644 --- a/lbrynet/lbrynet_daemon/Daemon.py +++ b/lbrynet/lbrynet_daemon/Daemon.py @@ -820,9 +820,10 @@ class Daemon(AuthJSONRPCServer): claim_out = yield publisher.update_stream(name, bid, metadata) else: claim_out = yield publisher.publish_stream(name, file_path, bid, metadata) - d = reupload.reflect_stream(publisher.lbry_file) - d.addCallbacks(lambda _: log.info("Reflected new publication to lbry://%s", name), - log.exception) + if conf.settings['reflect_uploads']: + d = reupload.reflect_stream(publisher.lbry_file) + d.addCallbacks(lambda _: log.info("Reflected new publication to lbry://%s", name), + log.exception) log.info("Success! Published to lbry://%s txid: %s nout: %d", name, claim_out['txid'], claim_out['nout']) yield self._add_to_pending_claims(claim_out, name)