Commit Graph
212 Commits
Author SHA1 Message Date
A_D d5dd23ce38 Missed an add_event call 2020-08-07 13:34:31 +02:00
A_D dd85fc0504 Rewrote inara queue system
This replaces the list+queue system that the inara plugin originally
used with a deque based one.

The main differences here are that the list the worker thread uses to
send to inara and the list that events are added to is the same, with
the worker thread making a duplicate and clearing the original each time
it sends events (losing events if it fails to upload three times).

The format of the data has changed as well, from simple tuples to
NamedTuple classes that provide some extra type safety and sanity when
accessing fields.

The event queue itself is actually multiple queues, one per
API/FID/CMDR_name triplicate, thus allowing multiple commander switches
while we're running without causing any weird issues
2020-08-07 13:34:30 +02:00
A_D 81dfbdfb8e Added timeout_session, made inara use it
timeout_session provides two things, TimeoutAdapter, a HTTP adapter
subclass that automatically adds timeouts to all requests, and
new_session, which automatically creates a request.Session with the
adapter in the correct place.
2020-07-31 15:53:20 +02:00
A_D 21a285e6e9 added some more type hints 2020-07-31 15:47:28 +02:00
A_D f8d4731472 fixed incorrect indexing 2020-07-31 15:47:27 +02:00
A_D eba318430a Removed todos about unused args 2020-07-31 15:47:27 +02:00
A_D 446c812485 replaced oneline logic with multiline 2020-07-31 15:47:26 +02:00
A_D 67a260c07f added type hints to literals 2020-07-31 15:47:26 +02:00
A_D 9005798862 fixed incorrect comment 2020-07-31 15:47:25 +02:00
A_D bb1def48cd replaced list comp with filter 2020-07-31 15:47:25 +02:00
A_D a699ab062d fixed station link logic 2020-07-31 15:47:24 +02:00
A_D e74c5c8ceb replaced list comp with filter 2020-07-31 15:47:23 +02:00
A_D 820b29f7dd replace dict(list-comp) with dict comp 2020-07-31 15:47:23 +02:00
A_D 539580e38d Consistently formatted multi-line add_event calls 2020-07-31 15:47:22 +02:00
A_D 96279cb0af Replaced repeated entry['event'] with variable 2020-07-31 15:47:21 +02:00
A_D 71ad0f92ac removed outdated comment 2020-07-31 15:47:21 +02:00
A_D 8e49066ca4 Replaced convoluted or-based logic with terneries 2020-07-31 15:47:20 +02:00
A_D 9db9ed4dfc Cleaned up overlong lines 2020-07-31 15:47:19 +02:00
A_D 13c2679c38 Added spacing around scope changes 2020-07-31 15:47:19 +02:00
A_D 160013e3e5 Added type annotations and docstrings 2020-07-31 15:47:18 +02:00
A_D eec4c2ebd6 autoformat with autopep8 2020-07-31 15:47:18 +02:00
A_D ce4149efd5 Added debug logs 2020-07-29 14:58:17 +01:00
Athanasius 525ebae61d Merge pull request #625 from A-UNDERSCORE-D/fix/624-inara-too-fast
Switched to using a timer for inara updates
2020-07-28 11:26:51 +01:00
A_D b27e4a3628 fixed tk import and type annotations 2020-07-27 15:15:56 +02:00
A_D cad5f72b0a updated type annotation 2020-07-27 15:15:55 +02:00
A_D 7b231fb244 removed unicode specifier from string
python3 strings are always unicode
2020-07-27 15:15:55 +02:00
A_D 07c43d3057 added type annotations to globals 2020-07-27 15:15:54 +02:00
A_D e0462d8719 Replaced complex oneliner with multiline if 2020-07-27 15:15:54 +02:00
A_D 37181264c9 Added newline after scope changes 2020-07-27 15:15:53 +02:00
A_D 4eed4404c6 Added Any type hint to this
Resolves most type warnings
2020-07-27 15:15:53 +02:00
A_D ab58aa6355 autoformatted file 2020-07-27 15:15:52 +02:00
A_D d4299c224f dont force a send on exit
just try and send if we can
2020-07-27 15:12:32 +02:00
A_D bb817eee3b removed outdated comment 2020-07-27 15:08:47 +02:00
A_D 340f8928b3 switched to using config for last update time 2020-07-27 15:08:47 +02:00
A_D 34760683e5 added some debug logging 2020-07-27 15:08:46 +02:00
A_D 72498b3bbc Switched to using a timer for inara updates
This adds a new thread that will run in a loop sending inara events once
ever 30 seconds. The old method of sending once for "special" events has
been removed.
2020-07-27 15:08:46 +02:00
Athanasius d7c2372417 Flake8 cleanup round #2 2020-07-27 10:14:16 +01:00
Athanasius f9a23cc831 Clean up flake8 output for this branch 2020-07-27 09:37:10 +01:00
Athanasius 2e58d106bd logging.getLogger(appname) instead of import from EDMarketConnector
Using:

from EDMarketConnector import logger

causes issues if EDMarketConnector is already importing 'this' file.

So just get a logger using logger.getLogger(appname) instead.
`from config import appname` if needs be.
2020-07-27 06:57:52 +01:00
Athanasius 8e1f3b8a90 plugins/inara: Fix typo on except: 2020-07-27 06:57:52 +01:00
Athanasius 7d060aa325 plugins/inara: Convert to proper logging 2020-07-27 06:57:52 +01:00
Athanasius 7951463fba plugins/edsm: Converted to proper logging 2020-07-27 06:57:52 +01:00
Athanasius 6aa409388e plugins/eddn: Converted to proper logging 2020-07-27 06:57:52 +01:00
A_D 5aaf88b281 fix quoting style 2020-07-26 23:08:47 +01:00
A_D 87b7f639bb cleanup coriolis.py 2020-07-26 23:08:47 +01:00
Athanasius b6f6365566 plugins/edsm: Fix missing line of code
Bad paste or something, who knows ?
2020-07-21 18:25:03 +01:00
Athanasius 29e3cba67e plugins/edsm: Align with code tested in inara plugin
* Use same state logic as Inara plugin now has.
* this.system_link for the Tk item, this.system is the system name.
* Ensure station text+link set on prefs change.
# Add a set of future TODO items.
2020-07-21 17:29:03 +01:00
Athanasius 99d1578780 plugins/eddb: Align with code tested in inara plugin
* Use same state logic as Inara plugin now has.
* this.system_link for the Tk item, this.system is the system name.
* List some tests to pass (and later to be implemented as unittests).
* Be paranoid about URIs, quote them.
* Ensure station text+link set on prefs change.
2020-07-21 17:29:03 +01:00
Athanasius 01d4c12027 plugins/inara: population recording fix, and misc cleanups 2020-07-21 17:29:03 +01:00
Athanasius 4c4511a66d plugins/eddb: Remove misleading comments about 'Only use CAPI...'
This is needed for "not even running the game" CAPI update to be useful.
2020-07-21 17:29:03 +01:00