add config to disable reflecting on publish

This commit is contained in:
Alex Grintsvayg 2017-03-16 17:48:28 -04:00
parent ebb6813df3
commit 15517732ae
4 changed files with 9 additions and 5 deletions

View file

@ -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
*
*

View file

@ -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),

View file

@ -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)

View file

@ -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)