aa-killtracker 0.16.0__py3-none-any.whl → 0.17.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aa_killtracker-0.16.0.dist-info → aa_killtracker-0.17.0.dist-info}/METADATA +3 -3
- {aa_killtracker-0.16.0.dist-info → aa_killtracker-0.17.0.dist-info}/RECORD +9 -8
- killtracker/__init__.py +1 -1
- killtracker/app_settings.py +8 -1
- killtracker/apps.py +1 -0
- killtracker/checks.py +45 -0
- killtracker/tasks.py +8 -1
- {aa_killtracker-0.16.0.dist-info → aa_killtracker-0.17.0.dist-info}/WHEEL +0 -0
- {aa_killtracker-0.16.0.dist-info → aa_killtracker-0.17.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: aa-killtracker
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.17.0
|
4
4
|
Summary: An app for running killmail trackers with Alliance Auth and Discord.
|
5
5
|
Author-email: Erik Kalkoken <kalkoken87@gmail.com>
|
6
6
|
Requires-Python: >=3.8
|
@@ -117,7 +117,7 @@ Add below lines to your settings file:
|
|
117
117
|
# aa-killtracker
|
118
118
|
CELERYBEAT_SCHEDULE['killtracker_run_killtracker'] = {
|
119
119
|
'task': 'killtracker.tasks.run_killtracker',
|
120
|
-
'schedule':
|
120
|
+
'schedule': 60,
|
121
121
|
}
|
122
122
|
KILLTRACKER_QUEUE_ID = "" # Put your unique queue ID here
|
123
123
|
```
|
@@ -242,7 +242,7 @@ Note that all settings are optional and the app will use the documented default
|
|
242
242
|
Name | Description | Default
|
243
243
|
-- | -- | --
|
244
244
|
`KILLTRACKER_KILLMAIL_MAX_AGE_FOR_TRACKER`| Ignore killmails that are older than the given number in minutes. Sometimes killmails appear belated on ZKB, this feature ensures they don't create new alerts | `60`
|
245
|
-
`KILLTRACKER_MAX_KILLMAILS_PER_RUN`| Maximum number of killmails retrieved from ZKB by task run. This value should be set such that the task that fetches new killmails from ZKB every minute will reliable finish within one minute. To test this run a "Catch all" tracker and see how many killmails your system is capable of processing. Note that you can get that information from the worker's log file. It will look something like this: `Total killmails received from ZKB in 49 secs:
|
245
|
+
`KILLTRACKER_MAX_KILLMAILS_PER_RUN`| Maximum number of killmails retrieved from ZKB by task run. This value should be set such that the task that fetches new killmails from ZKB every minute will reliable finish within one minute. To test this run a "Catch all" tracker and see how many killmails your system is capable of processing. Note that you can get that information from the worker's log file. It will look something like this: `Total killmails received from ZKB in 49 secs: 100` | `100`
|
246
246
|
`KILLTRACKER_PURGE_KILLMAILS_AFTER_DAYS`| Killmails older than set number of days will be purged from the database. If you want to keep all killmails set this to 0. Note that this setting is only relevant if you have storing killmails enabled. | `30`
|
247
247
|
`KILLTRACKER_QUEUE_ID`| Unique ID used to identify this server when fetching killmails from zKillboard. This setting is mandatory. | ``
|
248
248
|
`KILLTRACKER_STORING_KILLMAILS_ENABLED`| If set to true Killtracker will automatically store all received killmails in the local database. This can be useful if you want to run analytics on killmails etc. However, please note that Killtracker itself currently does not use stored killmails in any way. | `False`
|
@@ -1,13 +1,14 @@
|
|
1
|
-
killtracker/__init__.py,sha256=
|
1
|
+
killtracker/__init__.py,sha256=g8DgOYglXz6Q4YuXHKdw2HdUBMexl4BSn7RbdC-hnGo,355
|
2
2
|
killtracker/admin.py,sha256=s_O86Ct4prno0cQJE8otumCEqgkZ7H3Q_GFptEOTI_c,14103
|
3
|
-
killtracker/app_settings.py,sha256=
|
4
|
-
killtracker/apps.py,sha256=
|
3
|
+
killtracker/app_settings.py,sha256=8owiemErRDKxkYY4XB0vFHTI9EqRMjz2SZGTTsEA2ao,3886
|
4
|
+
killtracker/apps.py,sha256=yYOv4_T_eIiK5M7gr9Dre20WaNQXRKYOdfKyrforNhM,380
|
5
|
+
killtracker/checks.py,sha256=ytqWlhIbCsvGKi3xFbUvAZzbUlgOhiOrB67PZ2WfxM4,1311
|
5
6
|
killtracker/constants.py,sha256=W7-VARE3B4_sdzV_9k7qunUzlxTcdSAeSp_ZJVnbUhw,2514
|
6
7
|
killtracker/exceptions.py,sha256=aFY6qxQOta1V-qvgKp19Cgy6M16O7Si8moc2205OsX0,846
|
7
8
|
killtracker/forms.py,sha256=BqJYcAQ9jbZxTkDsHxrxj0qKKTIGIW0mShbBYdCDlaA,5182
|
8
9
|
killtracker/managers.py,sha256=JCrfc3yrKD4uHCfIzPu7y2HF-VIJm1yskdc-CFEf7V4,4390
|
9
10
|
killtracker/providers.py,sha256=smkZe_rKHkZeWFzJ0RhIhJVcbrZUpLYR5fKCge-dpXY,348
|
10
|
-
killtracker/tasks.py,sha256=
|
11
|
+
killtracker/tasks.py,sha256=GNdX1BGTWgR_wD_Eep6ibPHqC-PFIeVXDiyIJE7vW-E,8109
|
11
12
|
killtracker/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
13
|
killtracker/core/discord_messages.py,sha256=mOKiMWq-3WnaSUFbfgVmlkAedGTZ7OWcVxLp7n58-Z0,14132
|
13
14
|
killtracker/core/killmails.py,sha256=v7ciMSPHyIg4L4d-Q8UECuqJShfxfd3g_sdfRnKKSPY,20499
|
@@ -60,7 +61,7 @@ killtracker/tests/testdata/killmails.json,sha256=HKfpXQJ_ikymBSewh4wWixYpLwC3kNB
|
|
60
61
|
killtracker/tests/testdata/load_eveuniverse.py,sha256=FitVc12E_ob56ezK5Y1q07Kbyc7N8poHiCNaLRGU4Jg,388
|
61
62
|
killtracker/tools/drop_tables_killtracker.sql,sha256=fJrGY23NKRunpYC3hI-klFkWub4sBuhfP8TaT__zjPg,1726
|
62
63
|
killtracker/tools/generate_conditions_text.py,sha256=LxAtTQIX-IbuqaNDMV1XHhq5AbrrlwxLWgXa1M7DWQo,767
|
63
|
-
aa_killtracker-0.
|
64
|
-
aa_killtracker-0.
|
65
|
-
aa_killtracker-0.
|
66
|
-
aa_killtracker-0.
|
64
|
+
aa_killtracker-0.17.0.dist-info/licenses/LICENSE,sha256=XZiwB_S_40_HhnvLg5xvtBb3g1oGjPrk0rpFwk8iInE,1070
|
65
|
+
aa_killtracker-0.17.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
66
|
+
aa_killtracker-0.17.0.dist-info/METADATA,sha256=ixjtGgUPTMWb4glIZb_EmI-WZMdl9R9BLLR-aUlV9Gg,13927
|
67
|
+
aa_killtracker-0.17.0.dist-info/RECORD,,
|
killtracker/__init__.py
CHANGED
killtracker/app_settings.py
CHANGED
@@ -14,7 +14,7 @@ this feature ensures they don't create new alerts.
|
|
14
14
|
"""
|
15
15
|
|
16
16
|
KILLTRACKER_MAX_KILLMAILS_PER_RUN = clean_setting(
|
17
|
-
"KILLTRACKER_MAX_KILLMAILS_PER_RUN",
|
17
|
+
"KILLTRACKER_MAX_KILLMAILS_PER_RUN", 100
|
18
18
|
)
|
19
19
|
"""Maximum number of killmails retrieved from ZKB by task run."""
|
20
20
|
|
@@ -99,3 +99,10 @@ KILLTRACKER_STORAGE_KILLMAILS_LIFETIME = clean_setting(
|
|
99
99
|
"KILLTRACKER_STORAGE_KILLMAILS_LIFETIME", 3_600 * 1
|
100
100
|
)
|
101
101
|
"""Max lifetime of killmails in temporary storage in seconds."""
|
102
|
+
|
103
|
+
KILLTRACKER_ZKB_REQUEST_DELAY = clean_setting("KILLTRACKER_ZKB_REQUEST_DELAY", 500)
|
104
|
+
"""Delay between subsequent calls to ZKB API in milliseconds.
|
105
|
+
|
106
|
+
This delay ensures the app does not breach the CloudFlare rate limit of currently
|
107
|
+
two (2) requests per second per IP address.
|
108
|
+
"""
|
killtracker/apps.py
CHANGED
killtracker/checks.py
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
"""Django checks."""
|
2
|
+
|
3
|
+
import numbers
|
4
|
+
|
5
|
+
from django.conf import settings
|
6
|
+
from django.core.checks import Warning as DjangoWarning
|
7
|
+
from django.core.checks import register
|
8
|
+
|
9
|
+
|
10
|
+
@register()
|
11
|
+
def killtracker_config_check(app_configs, **kwargs): # pylint: disable=W0613
|
12
|
+
"""killtracker_config_check is a Django check that verifies that all periodic tasks
|
13
|
+
have been configured correctly in settings.
|
14
|
+
"""
|
15
|
+
if not hasattr(settings, "CELERYBEAT_SCHEDULE"):
|
16
|
+
return []
|
17
|
+
|
18
|
+
warnings = []
|
19
|
+
for name, obj in settings.CELERYBEAT_SCHEDULE.items():
|
20
|
+
_verify_task_config(warnings, name, obj, "killtracker.tasks.run_killtracker")
|
21
|
+
return warnings
|
22
|
+
|
23
|
+
|
24
|
+
def _verify_task_config(warnings: list, name: str, obj: dict, task_name: str):
|
25
|
+
if obj["task"] != task_name:
|
26
|
+
return
|
27
|
+
|
28
|
+
schedule = obj["schedule"]
|
29
|
+
if isinstance(schedule, numbers.Number):
|
30
|
+
return
|
31
|
+
|
32
|
+
warnings.append(
|
33
|
+
DjangoWarning(
|
34
|
+
(
|
35
|
+
"Periodic task has deprecated schedule: "
|
36
|
+
f'CELERYBEAT_SCHEDULE["{name}"]'
|
37
|
+
),
|
38
|
+
hint=(
|
39
|
+
'The value for "schedule" must be a positive number, '
|
40
|
+
"not e.g. a cron definition. "
|
41
|
+
f"Current value is: {schedule}"
|
42
|
+
),
|
43
|
+
id="killtracker.W001",
|
44
|
+
)
|
45
|
+
)
|
killtracker/tasks.py
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
"""Tasks for killtracker."""
|
2
2
|
|
3
|
+
from datetime import timedelta
|
4
|
+
|
3
5
|
from celery import chain, shared_task
|
4
6
|
|
5
7
|
from django.db import IntegrityError
|
8
|
+
from django.utils.timezone import now
|
6
9
|
from eveuniverse.core.esitools import is_esi_online
|
7
10
|
from eveuniverse.tasks import update_unresolved_eve_entities
|
8
11
|
|
@@ -22,6 +25,7 @@ from .app_settings import (
|
|
22
25
|
KILLTRACKER_STORING_KILLMAILS_ENABLED,
|
23
26
|
KILLTRACKER_TASK_OBJECTS_CACHE_TIMEOUT,
|
24
27
|
KILLTRACKER_TASKS_TIMEOUT,
|
28
|
+
KILLTRACKER_ZKB_REQUEST_DELAY,
|
25
29
|
)
|
26
30
|
from .core.killmails import Killmail
|
27
31
|
from .exceptions import WebhookTooManyRequests
|
@@ -69,7 +73,10 @@ def run_killtracker(runs: int = 0) -> None:
|
|
69
73
|
|
70
74
|
total_killmails = runs + (1 if killmail else 0)
|
71
75
|
if killmail and total_killmails < KILLTRACKER_MAX_KILLMAILS_PER_RUN:
|
72
|
-
run_killtracker.
|
76
|
+
run_killtracker.apply_async(
|
77
|
+
kwargs={"runs": runs + 1},
|
78
|
+
eta=now() + timedelta(milliseconds=KILLTRACKER_ZKB_REQUEST_DELAY),
|
79
|
+
)
|
73
80
|
else:
|
74
81
|
if (
|
75
82
|
KILLTRACKER_STORING_KILLMAILS_ENABLED
|
File without changes
|
File without changes
|