mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-05-30 07:09:39 +03:00
Added docs, fixed incorrect kill switch names
This commit is contained in:
parent
c96e59f7b3
commit
2d127ae3d0
53
docs/Killswitches.md
Normal file
53
docs/Killswitches.md
Normal file
@ -0,0 +1,53 @@
|
||||
# Kill Switches
|
||||
|
||||
EDMarketConnector implements a Kill Switch system that allows us to disable features based on a version mask. Meaning that we can stop major bugs from affecting the services we support, at the expense of disabling that support.
|
||||
|
||||
## Format
|
||||
|
||||
Killswitches are stored in a JSON file that is queried by EDMC on startup. The format is as follows:
|
||||
|
||||
| Key | Type | Description |
|
||||
| --------------: | :-----: | :------------------------------------------------------------ |
|
||||
| `version` | integer | the version of the Kill Switch JSON file, always 1 |
|
||||
| `last_updated` | string | When last the kill switches were updated (for human use only) |
|
||||
| `kill_switches` | array | The kill switches this file contains (expanded below) |
|
||||
|
||||
The `kill_switches` array contains kill switch objects. Each contains two fields:
|
||||
|
||||
| Key | Type | Description |
|
||||
| --------: | :----------------: | :---------------------------------------------------------------------- |
|
||||
| `version` | `semantic version` | The version of EDMC these kill switches apply to (Must be valid semver) |
|
||||
| `kills` | array of strings | The different keys to disable |
|
||||
An example follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 1,
|
||||
"last_updated": "19 October 2020",
|
||||
"kill_switches": [
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"kills": ["plugins.eddn.send"]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Versions
|
||||
|
||||
Versions are checked using equality checks on `semantic_version.Version` instances. Meaning that **all** fields are checked (ie, Major, Minor, Patch, Prerelease, and Build).
|
||||
|
||||
## Plugin support
|
||||
|
||||
Plugins may use the killswitch system simply by hosting their own version of the killswitch file, and fetching it
|
||||
using `killswitch.get_kill_switches(target='https://example.com/myplugin_killswitches.json')`. The returned object can
|
||||
be used to query the kill switch set, see the docstrings for more information on specifying versions.
|
||||
|
||||
## Currently supported killswitch strings
|
||||
|
||||
The current recognised (to EDMC and its internal plugins) killswitch strings are as follows:
|
||||
| Kill Switch | Description |
|
||||
| :--------------------- | :---------------------------------------------------------------------------------------- |
|
||||
| `plugins.eddn.send` | Disables all use of the send method on EDDN (effectively disables EDDN updates) |
|
||||
| `plugins.edsm.worker` | Disables the send portion of the EDSM worker thread (effectively disables EDSM updates) |
|
||||
| `plugins.inara.worker` | Disables the send portion of the INARA worker thread (effectively disables INARA updates) |
|
@ -127,7 +127,7 @@ class EDDN:
|
||||
:param cmdr: the CMDR to use as the uploader ID
|
||||
:param msg: the payload to send
|
||||
"""
|
||||
if killswitch.is_disabled('plugins.eddn_send'):
|
||||
if killswitch.is_disabled('plugins.eddn.send'):
|
||||
logger.warning("eddn.send has been disabled via killswitch. Returning")
|
||||
return
|
||||
|
||||
|
@ -509,7 +509,7 @@ def worker() -> None:
|
||||
logger.debug('Empty queue message, setting closing = True')
|
||||
closing = True # Try to send any unsent events before we close
|
||||
|
||||
if killswitch.is_disabled("plugins.eddn.worker"):
|
||||
if killswitch.is_disabled("plugins.edsm.worker"):
|
||||
logger.warning('EDSM worker has been disabled via kill switch. Not uploading data.')
|
||||
continue
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user