updated eddn to new killswitches

This commit is contained in:
A_D committed 2021-08-19 20:37:39 +02:00
1 parent f62f1ee97b
commit 6c7245ee3d
2 files changed
+13 -7

No files matched your search

+1 -1
View File
@@ -92,7 +92,7 @@ The current recognised (to EDMC and its internal plugins) killswitch strings are
| Kill Switch | Supported Plugins | Description |
| :------------------------------------------- | :---------------------: | :---------------------------------------------------------------------------------------- |
| *`plugins.eddn.send` | eddn | Disables all use of the send method on EDDN (effectively disables EDDN updates) |
| `plugins.eddn.send` | eddn | Disables all use of the send method on EDDN (effectively disables EDDN updates) |
| `plugins.<plugin>.journal` | eddn, inara, edsm, eddb | Disables all journal processing for the plugin |
| `plugins.<plugin>.worker` | edsm, inara | Disables the plugins worker thread (effectively disables updates) (does not close thread) |
| `plugins.<plugin>.worker.<eventname>` | edsm, inara | Disables the plugin worker for the given eventname |
+12 -6
View File
@@ -168,10 +168,13 @@ class EDDN:
:param cmdr: the CMDR to use as the uploader ID.
:param msg: the payload to send.
"""
if (res := killswitch.get_disabled('plugins.eddn.send')).disabled:
logger.warning(f"eddn.send has been disabled via killswitch. Returning. ({res.reason})")
should_return, new_data = killswitch.check_killswitch('plugins.eddn.send', msg)
if should_return:
logger.warning('eddn.send has been disabled via killswitch. Returning.')
return
msg = new_data
uploader_id = cmdr
to_send: OrderedDictT[str, OrderedDict[str, Any]] = OrderedDict([
@@ -787,15 +790,18 @@ def journal_entry( # noqa: C901, CCR001
:param state: `dict` - Current `monitor.state` data.
:return: `str` - Error message, or `None` if no errors.
"""
if (ks := killswitch.get_disabled("plugins.eddn.journal")).disabled:
logger.warning(f'EDDN journal handler has been disabled via killswitch: {ks.reason}')
should_return, new_data = killswitch.check_killswitch('plugins.eddn.journal', entry)
if should_return:
plug.show_error(_('EDDN journal handler disabled. See Log.')) # LANG: Killswitch disabled EDDN
return None
elif (ks := killswitch.get_disabled(f'plugins.eddn.journal.event.{entry["event"]}')).disabled:
logger.warning(f'Handling of event {entry["event"]} disabled via killswitch: {ks.reason}')
should_return, new_data = killswitch.check_killswitch(f'plugins.eddn.journal.event.{entry["event"]}', new_data)
if should_return:
return None
entry = new_data
# Recursively filter '*_Localised' keys from dict
def filter_localised(d: Mapping[str, Any]) -> OrderedDictT[str, Any]:
filtered: OrderedDictT[str, Any] = OrderedDict()