forked from LBRYCommunity/lbry-sdk
enable/disable instead of set
This commit is contained in:
parent
ec541e2057
commit
d44d5c3304
2 changed files with 23 additions and 10 deletions
|
@ -4537,22 +4537,35 @@ class Daemon(metaclass=JSONRPCServerType):
|
|||
Controls and queries tracemalloc memory tracing tools for troubleshooting.
|
||||
"""
|
||||
|
||||
def jsonrpc_tracemalloc_set(self, enable: bool): # pylint: disable=no-self-use
|
||||
def jsonrpc_tracemalloc_enable(self): # pylint: disable=no-self-use
|
||||
"""
|
||||
Enable/disable tracemalloc memory tracing
|
||||
Enable tracemalloc memory tracing
|
||||
|
||||
Usage:
|
||||
jsonrpc_tracemalloc_set (<enable> | --enable=<enable>)
|
||||
jsonrpc_tracemalloc_enable
|
||||
|
||||
Options:
|
||||
--enable=<enable> : (bool) True enables, False disables
|
||||
None
|
||||
|
||||
Returns:
|
||||
(bool) is it tracing?
|
||||
"""
|
||||
if enable:
|
||||
tracemalloc.start()
|
||||
else:
|
||||
return tracemalloc.is_tracing()
|
||||
|
||||
def jsonrpc_tracemalloc_disable(self): # pylint: disable=no-self-use
|
||||
"""
|
||||
Disable tracemalloc memory tracing
|
||||
|
||||
Usage:
|
||||
jsonrpc_tracemalloc_disable
|
||||
|
||||
Options:
|
||||
None
|
||||
|
||||
Returns:
|
||||
(bool) is it tracing?
|
||||
"""
|
||||
tracemalloc.stop()
|
||||
return tracemalloc.is_tracing()
|
||||
|
||||
|
|
|
@ -42,8 +42,8 @@ class SettingsManagement(CommandTestCase):
|
|||
|
||||
class TroubleshootingCommands(CommandTestCase):
|
||||
async def test_tracemalloc_commands(self):
|
||||
self.assertFalse(self.daemon.jsonrpc_tracemalloc_set(False))
|
||||
self.assertTrue(self.daemon.jsonrpc_tracemalloc_set(True))
|
||||
self.assertFalse(self.daemon.jsonrpc_tracemalloc_disable())
|
||||
self.assertTrue(self.daemon.jsonrpc_tracemalloc_enable())
|
||||
|
||||
class WeirdObject():
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue