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.
|
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:
|
Usage:
|
||||||
jsonrpc_tracemalloc_set (<enable> | --enable=<enable>)
|
jsonrpc_tracemalloc_enable
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--enable=<enable> : (bool) True enables, False disables
|
None
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(bool) is it tracing?
|
(bool) is it tracing?
|
||||||
"""
|
"""
|
||||||
if enable:
|
|
||||||
tracemalloc.start()
|
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()
|
tracemalloc.stop()
|
||||||
return tracemalloc.is_tracing()
|
return tracemalloc.is_tracing()
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,8 @@ class SettingsManagement(CommandTestCase):
|
||||||
|
|
||||||
class TroubleshootingCommands(CommandTestCase):
|
class TroubleshootingCommands(CommandTestCase):
|
||||||
async def test_tracemalloc_commands(self):
|
async def test_tracemalloc_commands(self):
|
||||||
self.assertFalse(self.daemon.jsonrpc_tracemalloc_set(False))
|
self.assertFalse(self.daemon.jsonrpc_tracemalloc_disable())
|
||||||
self.assertTrue(self.daemon.jsonrpc_tracemalloc_set(True))
|
self.assertTrue(self.daemon.jsonrpc_tracemalloc_enable())
|
||||||
|
|
||||||
class WeirdObject():
|
class WeirdObject():
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in a new issue