Added a simple tickers command for inspecting the running tickers (no manipulation at this time, not sure how to make that in a safe way).
This commit is contained in:
parent
dd6b6f06f7
commit
cc5fe43372
4 changed files with 41 additions and 1 deletions
|
|
@ -2574,4 +2574,3 @@ class CmdSpawn(MuxCommand):
|
|||
for obj in spawn(prototype):
|
||||
self.caller.msg("Spawned %s." % obj.get_display_name(self.caller))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class CharacterCmdSet(CmdSet):
|
|||
self.add(system.CmdTime())
|
||||
self.add(system.CmdServerLoad())
|
||||
#self.add(system.CmdPs())
|
||||
self.add(system.CmdTickers())
|
||||
|
||||
# Admin commands
|
||||
self.add(admin.CmdBoot())
|
||||
|
|
|
|||
|
|
@ -755,3 +755,30 @@ class CmdServerLoad(MuxCommand):
|
|||
|
||||
# return to caller
|
||||
self.caller.msg(string)
|
||||
|
||||
class CmdTickers(MuxCommand):
|
||||
"""
|
||||
View and manage running tickers
|
||||
|
||||
Usage:
|
||||
@tickers
|
||||
|
||||
"""
|
||||
key = "@tickers"
|
||||
help_category = "System"
|
||||
|
||||
def func(self):
|
||||
from evennia import TICKER_HANDLER
|
||||
all_subs = TICKER_HANDLER.all_display()
|
||||
table = EvTable("interv(s)", "object", "path/methodname", "idstring")
|
||||
for sub in all_subs:
|
||||
table.add_row(sub[3],
|
||||
sub[1] or "[None]",
|
||||
sub[1] if sub[1] else sub[2],
|
||||
sub[4] or "[Unset]")
|
||||
return self.caller.msg(table)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -492,5 +492,18 @@ class TickerHandler(object):
|
|||
if ticker:
|
||||
return {interval: ticker.subscriptions}
|
||||
|
||||
def all_display(self):
|
||||
"""
|
||||
Get all tickers on an easily displayable form.
|
||||
|
||||
Returns:
|
||||
tickers (dict): A list of all storekeys
|
||||
|
||||
"""
|
||||
store_keys = []
|
||||
for ticker in self.ticker_pool.tickers.itervalues():
|
||||
store_keys.extend([store_key for store_key in ticker.subscriptions])
|
||||
return store_keys
|
||||
|
||||
# main tickerhandler
|
||||
TICKER_HANDLER = TickerHandler()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue