mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-19 16:24:07 +03:00
updated eddn to new killswitches
This commit is contained in:
parent
f62f1ee97b
commit
6c7245ee3d
@ -92,7 +92,7 @@ The current recognised (to EDMC and its internal plugins) killswitch strings are
|
|||||||
|
|
||||||
| Kill Switch | Supported Plugins | Description |
|
| 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>.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` | 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 |
|
| `plugins.<plugin>.worker.<eventname>` | edsm, inara | Disables the plugin worker for the given eventname |
|
||||||
|
@ -168,10 +168,13 @@ class EDDN:
|
|||||||
:param cmdr: the CMDR to use as the uploader ID.
|
:param cmdr: the CMDR to use as the uploader ID.
|
||||||
:param msg: the payload to send.
|
:param msg: the payload to send.
|
||||||
"""
|
"""
|
||||||
if (res := killswitch.get_disabled('plugins.eddn.send')).disabled:
|
should_return, new_data = killswitch.check_killswitch('plugins.eddn.send', msg)
|
||||||
logger.warning(f"eddn.send has been disabled via killswitch. Returning. ({res.reason})")
|
if should_return:
|
||||||
|
logger.warning('eddn.send has been disabled via killswitch. Returning.')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
msg = new_data
|
||||||
|
|
||||||
uploader_id = cmdr
|
uploader_id = cmdr
|
||||||
|
|
||||||
to_send: OrderedDictT[str, OrderedDict[str, Any]] = OrderedDict([
|
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.
|
:param state: `dict` - Current `monitor.state` data.
|
||||||
:return: `str` - Error message, or `None` if no errors.
|
: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
|
plug.show_error(_('EDDN journal handler disabled. See Log.')) # LANG: Killswitch disabled EDDN
|
||||||
return None
|
return None
|
||||||
|
|
||||||
elif (ks := killswitch.get_disabled(f'plugins.eddn.journal.event.{entry["event"]}')).disabled:
|
should_return, new_data = killswitch.check_killswitch(f'plugins.eddn.journal.event.{entry["event"]}', new_data)
|
||||||
logger.warning(f'Handling of event {entry["event"]} disabled via killswitch: {ks.reason}')
|
if should_return:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
entry = new_data
|
||||||
|
|
||||||
# Recursively filter '*_Localised' keys from dict
|
# Recursively filter '*_Localised' keys from dict
|
||||||
def filter_localised(d: Mapping[str, Any]) -> OrderedDictT[str, Any]:
|
def filter_localised(d: Mapping[str, Any]) -> OrderedDictT[str, Any]:
|
||||||
filtered: OrderedDictT[str, Any] = OrderedDict()
|
filtered: OrderedDictT[str, Any] = OrderedDict()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user