From f87d6b08c8b8d99b7db70d8fce79569d46e57378 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Mon, 6 Nov 2017 15:44:09 -0500 Subject: [PATCH] remove queued decorator --- CHANGELOG.md | 5 ++--- lbrynet/daemon/Daemon.py | 2 -- lbrynet/daemon/auth/server.py | 15 +-------------- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 687daad0e..673b26204 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ at anytime. * Fixed incorrect response on attempting to delete blob twice * Fixed local node ID reporting in peer list * + * Fixed lbryum race condition between combinations of `publish` and `channel_new` ### Deprecated * @@ -27,16 +28,14 @@ at anytime. ### Changed * Moved BLOB_SIZE from conf.py to MAX_BLOB_SIZE in blob/blob_file.py - * Use shared deferredSemaphore for api methods decorated with `@AuthJSONRPCServer.queued` ### Added * Added `utxo_list` command to list unspent transaction outputs * Added redundant API server for currency conversion - * ### Removed * Removed some alternate methods of reading from blob files - * + * Removed `@AuthJSONRPCServer.queued` decorator ## [0.17.1] - 2017-10-25 diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index 5158cc5d5..8812d233c 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -1701,7 +1701,6 @@ class Daemon(AuthJSONRPCServer): defer.returnValue(cost) @AuthJSONRPCServer.auth_required - @AuthJSONRPCServer.queued @defer.inlineCallbacks def jsonrpc_channel_new(self, channel_name, amount): """ @@ -1759,7 +1758,6 @@ class Daemon(AuthJSONRPCServer): defer.returnValue(response) @AuthJSONRPCServer.auth_required - @AuthJSONRPCServer.queued @defer.inlineCallbacks def jsonrpc_publish(self, name, bid, metadata=None, file_path=None, fee=None, title=None, description=None, author=None, language=None, license=None, diff --git a/lbrynet/daemon/auth/server.py b/lbrynet/daemon/auth/server.py index f2f936992..0f9e8ec7c 100644 --- a/lbrynet/daemon/auth/server.py +++ b/lbrynet/daemon/auth/server.py @@ -116,7 +116,6 @@ class JSONRPCServerType(type): klass.callable_methods = {} klass.deprecated_methods = {} klass.authorized_functions = [] - klass.queued_methods = [] for methodname in dir(klass): if methodname.startswith("jsonrpc_"): @@ -125,8 +124,6 @@ class JSONRPCServerType(type): klass.callable_methods.update({methodname.split("jsonrpc_")[1]: method}) if hasattr(method, '_auth_required'): klass.authorized_functions.append(methodname.split("jsonrpc_")[1]) - if hasattr(method, '_queued'): - klass.queued_methods.append(methodname.split("jsonrpc_")[1]) else: klass.deprecated_methods.update({methodname.split("jsonrpc_")[1]: method}) return klass @@ -140,11 +137,6 @@ class AuthorizedBase(object): f._auth_required = True return f - @staticmethod - def queued(f): - f._queued = True - return f - @staticmethod def deprecated(new_command=None): def _deprecated_wrapper(f): @@ -196,7 +188,6 @@ class AuthJSONRPCServer(AuthorizedBase): ) self.announced_startup = False self.sessions = {} - self._queued_lock = defer.DeferredSemaphore(1) def setup(self): return NotImplementedError() @@ -289,7 +280,6 @@ class AuthJSONRPCServer(AuthorizedBase): id_ = None try: function_name = parsed.get('method') - is_queued = function_name in self.queued_methods args = parsed.get('params', {}) id_ = parsed.get('id', None) token = parsed.pop('hmac', None) @@ -362,10 +352,7 @@ class AuthJSONRPCServer(AuthorizedBase): ) return server.NOT_DONE_YET - if is_queued: - d = self._queued_lock.run(fn, self, **args_dict) - else: - d = defer.maybeDeferred(fn, self, **args_dict) + d = defer.maybeDeferred(fn, self, **args_dict) # finished_deferred will callback when the request is finished # and errback if something went wrong. If the errback is