forked from LBRYCommunity/lbry-sdk
remove queued decorator
This commit is contained in:
parent
5bb08cdf5a
commit
f87d6b08c8
3 changed files with 3 additions and 19 deletions
|
@ -20,6 +20,7 @@ at anytime.
|
||||||
* Fixed incorrect response on attempting to delete blob twice
|
* Fixed incorrect response on attempting to delete blob twice
|
||||||
* Fixed local node ID reporting in peer list
|
* Fixed local node ID reporting in peer list
|
||||||
*
|
*
|
||||||
|
* Fixed lbryum race condition between combinations of `publish` and `channel_new`
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
*
|
*
|
||||||
|
@ -27,16 +28,14 @@ at anytime.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Moved BLOB_SIZE from conf.py to MAX_BLOB_SIZE in blob/blob_file.py
|
* 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
|
||||||
* Added `utxo_list` command to list unspent transaction outputs
|
* Added `utxo_list` command to list unspent transaction outputs
|
||||||
* Added redundant API server for currency conversion
|
* Added redundant API server for currency conversion
|
||||||
*
|
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
* Removed some alternate methods of reading from blob files
|
* Removed some alternate methods of reading from blob files
|
||||||
*
|
* Removed `@AuthJSONRPCServer.queued` decorator
|
||||||
|
|
||||||
|
|
||||||
## [0.17.1] - 2017-10-25
|
## [0.17.1] - 2017-10-25
|
||||||
|
|
|
@ -1701,7 +1701,6 @@ class Daemon(AuthJSONRPCServer):
|
||||||
defer.returnValue(cost)
|
defer.returnValue(cost)
|
||||||
|
|
||||||
@AuthJSONRPCServer.auth_required
|
@AuthJSONRPCServer.auth_required
|
||||||
@AuthJSONRPCServer.queued
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def jsonrpc_channel_new(self, channel_name, amount):
|
def jsonrpc_channel_new(self, channel_name, amount):
|
||||||
"""
|
"""
|
||||||
|
@ -1759,7 +1758,6 @@ class Daemon(AuthJSONRPCServer):
|
||||||
defer.returnValue(response)
|
defer.returnValue(response)
|
||||||
|
|
||||||
@AuthJSONRPCServer.auth_required
|
@AuthJSONRPCServer.auth_required
|
||||||
@AuthJSONRPCServer.queued
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def jsonrpc_publish(self, name, bid, metadata=None, file_path=None, fee=None, title=None,
|
def jsonrpc_publish(self, name, bid, metadata=None, file_path=None, fee=None, title=None,
|
||||||
description=None, author=None, language=None, license=None,
|
description=None, author=None, language=None, license=None,
|
||||||
|
|
|
@ -116,7 +116,6 @@ class JSONRPCServerType(type):
|
||||||
klass.callable_methods = {}
|
klass.callable_methods = {}
|
||||||
klass.deprecated_methods = {}
|
klass.deprecated_methods = {}
|
||||||
klass.authorized_functions = []
|
klass.authorized_functions = []
|
||||||
klass.queued_methods = []
|
|
||||||
|
|
||||||
for methodname in dir(klass):
|
for methodname in dir(klass):
|
||||||
if methodname.startswith("jsonrpc_"):
|
if methodname.startswith("jsonrpc_"):
|
||||||
|
@ -125,8 +124,6 @@ class JSONRPCServerType(type):
|
||||||
klass.callable_methods.update({methodname.split("jsonrpc_")[1]: method})
|
klass.callable_methods.update({methodname.split("jsonrpc_")[1]: method})
|
||||||
if hasattr(method, '_auth_required'):
|
if hasattr(method, '_auth_required'):
|
||||||
klass.authorized_functions.append(methodname.split("jsonrpc_")[1])
|
klass.authorized_functions.append(methodname.split("jsonrpc_")[1])
|
||||||
if hasattr(method, '_queued'):
|
|
||||||
klass.queued_methods.append(methodname.split("jsonrpc_")[1])
|
|
||||||
else:
|
else:
|
||||||
klass.deprecated_methods.update({methodname.split("jsonrpc_")[1]: method})
|
klass.deprecated_methods.update({methodname.split("jsonrpc_")[1]: method})
|
||||||
return klass
|
return klass
|
||||||
|
@ -140,11 +137,6 @@ class AuthorizedBase(object):
|
||||||
f._auth_required = True
|
f._auth_required = True
|
||||||
return f
|
return f
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def queued(f):
|
|
||||||
f._queued = True
|
|
||||||
return f
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def deprecated(new_command=None):
|
def deprecated(new_command=None):
|
||||||
def _deprecated_wrapper(f):
|
def _deprecated_wrapper(f):
|
||||||
|
@ -196,7 +188,6 @@ class AuthJSONRPCServer(AuthorizedBase):
|
||||||
)
|
)
|
||||||
self.announced_startup = False
|
self.announced_startup = False
|
||||||
self.sessions = {}
|
self.sessions = {}
|
||||||
self._queued_lock = defer.DeferredSemaphore(1)
|
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
return NotImplementedError()
|
return NotImplementedError()
|
||||||
|
@ -289,7 +280,6 @@ class AuthJSONRPCServer(AuthorizedBase):
|
||||||
id_ = None
|
id_ = None
|
||||||
try:
|
try:
|
||||||
function_name = parsed.get('method')
|
function_name = parsed.get('method')
|
||||||
is_queued = function_name in self.queued_methods
|
|
||||||
args = parsed.get('params', {})
|
args = parsed.get('params', {})
|
||||||
id_ = parsed.get('id', None)
|
id_ = parsed.get('id', None)
|
||||||
token = parsed.pop('hmac', None)
|
token = parsed.pop('hmac', None)
|
||||||
|
@ -362,10 +352,7 @@ class AuthJSONRPCServer(AuthorizedBase):
|
||||||
)
|
)
|
||||||
return server.NOT_DONE_YET
|
return server.NOT_DONE_YET
|
||||||
|
|
||||||
if is_queued:
|
d = defer.maybeDeferred(fn, self, **args_dict)
|
||||||
d = self._queued_lock.run(fn, self, **args_dict)
|
|
||||||
else:
|
|
||||||
d = defer.maybeDeferred(fn, self, **args_dict)
|
|
||||||
|
|
||||||
# finished_deferred will callback when the request is finished
|
# finished_deferred will callback when the request is finished
|
||||||
# and errback if something went wrong. If the errback is
|
# and errback if something went wrong. If the errback is
|
||||||
|
|
Loading…
Reference in a new issue