diff --git a/CHANGELOG.md b/CHANGELOG.md index 73d0f0ab2..062c7a5cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ at anytime. * ### Changed - * + * Dont add expected payment to wallet when payment rate is 0 * * diff --git a/lbrynet/analytics/api.py b/lbrynet/analytics/api.py index 546f93b30..67381c8e4 100644 --- a/lbrynet/analytics/api.py +++ b/lbrynet/analytics/api.py @@ -19,9 +19,10 @@ def log_response(fn): elif future.exception(): exc, traceback = future.exception_info() log.warning('Failed to send an analytics event', exc_info=(type(exc), exc, traceback)) - else: - response = future.result() - log.debug('Response (%s): %s', response.status_code, response.content) + # GRIN TURNED THIS OFF. Segment only has one response: {"success": true} + # else: + # response = future.result() + # log.debug('Response (%s): %s', response.status_code, response.content) @functools.wraps(fn) def wrapper(*args, **kwargs): diff --git a/lbrynet/core/server/BlobRequestHandler.py b/lbrynet/core/server/BlobRequestHandler.py index a47985bd8..4cce9fb59 100644 --- a/lbrynet/core/server/BlobRequestHandler.py +++ b/lbrynet/core/server/BlobRequestHandler.py @@ -5,12 +5,10 @@ from twisted.protocols.basic import FileSender from twisted.python.failure import Failure from zope.interface import implements - from lbrynet.core.Offer import Offer from lbrynet import analytics from lbrynet.interfaces import IQueryHandlerFactory, IQueryHandler, IBlobSender - log = logging.getLogger(__name__) @@ -212,11 +210,14 @@ class BlobRequestHandler(object): def set_expected_payment(): log.debug("Setting expected payment") - if self.blob_bytes_uploaded != 0 and self.blob_data_payment_rate is not None: + if ( + self.blob_bytes_uploaded != 0 and self.blob_data_payment_rate is not None + and self.blob_data_payment_rate > 0 + ): # TODO: explain why 2**20 self.wallet.add_expected_payment(self.peer, self.currently_uploading.length * 1.0 * - self.blob_data_payment_rate / 2**20) + self.blob_data_payment_rate / 2 ** 20) self.blob_bytes_uploaded = 0 self.peer.update_stats('blobs_uploaded', 1) return None diff --git a/lbrynet/lbrynet_daemon/Daemon.py b/lbrynet/lbrynet_daemon/Daemon.py index e72f2aaed..1584ea38c 100644 --- a/lbrynet/lbrynet_daemon/Daemon.py +++ b/lbrynet/lbrynet_daemon/Daemon.py @@ -1264,29 +1264,11 @@ class Daemon(AuthJSONRPCServer): """ Get daemon settings - Args: - None Returns: (dict) Dictionary of daemon settings - { - 'run_on_startup': (bool) currently not supported - 'data_rate': (float) data rate - 'max_key_fee': (float) maximum key fee - 'download_directory': (str) path of where files are downloaded - 'max_upload': (float), currently not supported - 'max_download': (float), currently not supported - 'download_timeout': (int) download timeout in seconds - 'max_search_results': (int) max search results - 'wallet_type': (str) wallet type - 'delete_blobs_on_remove': (bool) delete blobs on removal - 'peer_port': (int) peer port - 'dht_node_port': (int) dht node port - 'use_upnp': (bool) use upnp if true - } + See ADJUSTABLE_SETTINGS in lbrynet/conf.py for full list of settings """ - - log.info("Get daemon settings") - return self._render_response(conf.settings.get_current_settings_dict()) + return self._render_response(conf.settings.get_adjustable_settings_dict()) @AuthJSONRPCServer.auth_required def jsonrpc_set_settings(self, **kwargs): @@ -1296,6 +1278,7 @@ class Daemon(AuthJSONRPCServer): return self.jsonrpc_settings_set(**kwargs) @AuthJSONRPCServer.auth_required + @defer.inlineCallbacks def jsonrpc_settings_set(self, **kwargs): """ Set daemon settings @@ -1308,22 +1291,14 @@ class Daemon(AuthJSONRPCServer): 'max_upload': (float), currently not supported 'max_download': (float), currently not supported 'download_timeout': (int) download timeout in seconds + 'search_timeout': (float) search timeout in seconds + 'cache_time': (int) cache timeout in seconds Returns: - (dict) settings dict + (dict) Updated dictionary of daemon settings """ - def _log_settings_change(): - log.info( - "Set daemon settings to %s", - json.dumps(conf.settings.get_adjustable_settings_dict())) - - d = self._update_settings(kwargs) - d.addErrback(lambda err: log.info(err.getTraceback())) - d.addCallback(lambda _: _log_settings_change()) - d.addCallback( - lambda _: self._render_response(conf.settings.get_adjustable_settings_dict())) - - return d + yield self._update_settings(kwargs) + defer.returnValue(conf.settings.get_adjustable_settings_dict()) def jsonrpc_help(self, command=None): """