aa-killtracker 1.0.0a1__py3-none-any.whl → 1.1.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-1.0.0a1.dist-info → aa_killtracker-1.1.0.dist-info}/METADATA +2 -3
- {aa_killtracker-1.0.0a1.dist-info → aa_killtracker-1.1.0.dist-info}/RECORD +8 -8
- killtracker/__init__.py +1 -1
- killtracker/tasks.py +7 -7
- killtracker/tests/test_integration.py +1 -27
- killtracker/tests/test_tasks.py +0 -2
- {aa_killtracker-1.0.0a1.dist-info → aa_killtracker-1.1.0.dist-info}/WHEEL +0 -0
- {aa_killtracker-1.0.0a1.dist-info → aa_killtracker-1.1.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: aa-killtracker
|
3
|
-
Version: 1.0
|
3
|
+
Version: 1.1.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
|
@@ -20,7 +20,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
20
20
|
Classifier: Topic :: Internet :: WWW/HTTP
|
21
21
|
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
22
22
|
License-File: LICENSE
|
23
|
-
Requires-Dist: allianceauth-app-utils>=1.
|
23
|
+
Requires-Dist: allianceauth-app-utils>=1.27
|
24
24
|
Requires-Dist: allianceauth>=4,<5
|
25
25
|
Requires-Dist: dacite
|
26
26
|
Requires-Dist: dhooks-lite>=1.1
|
@@ -242,7 +242,6 @@ 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: 100` | `100`
|
246
245
|
`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
246
|
`KILLTRACKER_QUEUE_ID`| Unique ID used to identify this server when fetching killmails from zKillboard. This setting is mandatory. | ``
|
248
247
|
`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,4 +1,4 @@
|
|
1
|
-
killtracker/__init__.py,sha256=
|
1
|
+
killtracker/__init__.py,sha256=rOIvRvSFLhVD9FJyVCT5A2a9T2B95taKGvInCbwDYzk,354
|
2
2
|
killtracker/admin.py,sha256=IH04Q1etHUnXSJIhm3bnGfIbSU6lPSSaltLERb-OkYg,14229
|
3
3
|
killtracker/app_settings.py,sha256=KqWSS4OVKIa7DmBAa5AbwxFVXw5EQebPfBtPo1UJYgY,4295
|
4
4
|
killtracker/apps.py,sha256=lWolk2CVEHPNIMEylbK2fSuCSTRW1n6LBmiDjLoqqq4,384
|
@@ -8,7 +8,7 @@ killtracker/forms.py,sha256=SUM0U-Sa6FPcGVpsYJbVxHfEtf7hb1Qc_l92Zfa1OLk,5193
|
|
8
8
|
killtracker/managers.py,sha256=hrmpiuMzK-7p-AsT4ee0mMEhQv4b57AGmhlRTxEl7wk,4416
|
9
9
|
killtracker/providers.py,sha256=3DiOlklBq5kLGDV9nMlMbP2-S8AodNgR6gtB4cWWCUo,358
|
10
10
|
killtracker/signals.py,sha256=rFCg-WYMVPmAhuqX8KHNaicsP1nyj_HYA2O4Qr8wqhk,892
|
11
|
-
killtracker/tasks.py,sha256=
|
11
|
+
killtracker/tasks.py,sha256=4NTGw_pKs832b5h-YX6rT5zu4vdKS61WjGc1rf-WSiY,9296
|
12
12
|
killtracker/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
killtracker/core/discord.py,sha256=cJY1qZ1ULlndliqn304B2deZkgL8VRqnAN_E5bXbTPk,5330
|
14
14
|
killtracker/core/helpers.py,sha256=Ulwhz96IopCCNPD6m7ylz9IGnxknIvLSCfcLrmJ8uDE,335
|
@@ -40,8 +40,8 @@ killtracker/templates/admin/killtracker/tracker/killmail_test.html,sha256=TI2ON8
|
|
40
40
|
killtracker/tests/__init__.py,sha256=CEt5qqp6ptDrx1lwuA6epZ5bzh1CwUJYXeMZqWK9jT0,278
|
41
41
|
killtracker/tests/test_admin.py,sha256=XFAlF_Q4h5Z_agkmRtB30GmCayqQPblLolFrN41xu7Q,5659
|
42
42
|
killtracker/tests/test_admin_2.py,sha256=rP0EscM9qUil_ZuXute3R8TQY2P5XSjmxHLbziCGcVw,1140
|
43
|
-
killtracker/tests/test_integration.py,sha256=
|
44
|
-
killtracker/tests/test_tasks.py,sha256=
|
43
|
+
killtracker/tests/test_integration.py,sha256=9zvM6DJrMioBp1C5_RYLZNu1eHRSLVSwep9y1-bkHkI,2482
|
44
|
+
killtracker/tests/test_tasks.py,sha256=TnMFI6xIe2WNAx3sW5O0_OFVb3gF3CqRZI5ZhMN0ZO0,16140
|
45
45
|
killtracker/tests/test_utils.py,sha256=1TA0pzCpq8CAKRBTi_xZ9_45n3rPx7UclkgFPzT1VFY,1130
|
46
46
|
killtracker/tests/utils.py,sha256=auwXHSpLwI_Qi3NmQUOCrIAcEsuw04ZaNJW82-jD4DU,1139
|
47
47
|
killtracker/tests/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -68,7 +68,7 @@ killtracker/tests/testdata/killmails.json,sha256=HKfpXQJ_ikymBSewh4wWixYpLwC3kNB
|
|
68
68
|
killtracker/tests/testdata/load_eveuniverse.py,sha256=FitVc12E_ob56ezK5Y1q07Kbyc7N8poHiCNaLRGU4Jg,388
|
69
69
|
killtracker/tools/drop_tables_killtracker.sql,sha256=fJrGY23NKRunpYC3hI-klFkWub4sBuhfP8TaT__zjPg,1726
|
70
70
|
killtracker/tools/generate_conditions_text.py,sha256=LxAtTQIX-IbuqaNDMV1XHhq5AbrrlwxLWgXa1M7DWQo,767
|
71
|
-
aa_killtracker-1.0.
|
72
|
-
aa_killtracker-1.0.
|
73
|
-
aa_killtracker-1.0.
|
74
|
-
aa_killtracker-1.0.
|
71
|
+
aa_killtracker-1.1.0.dist-info/licenses/LICENSE,sha256=XZiwB_S_40_HhnvLg5xvtBb3g1oGjPrk0rpFwk8iInE,1070
|
72
|
+
aa_killtracker-1.1.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
73
|
+
aa_killtracker-1.1.0.dist-info/METADATA,sha256=qe2Vc-BhMf6pdRCdzZic2SNFFW0WwaXhi1KhoPA-R4w,13442
|
74
|
+
aa_killtracker-1.1.0.dist-info/RECORD,,
|
killtracker/__init__.py
CHANGED
killtracker/tasks.py
CHANGED
@@ -11,7 +11,7 @@ from eveuniverse.tasks import update_unresolved_eve_entities
|
|
11
11
|
|
12
12
|
from allianceauth.services.hooks import get_extension_logger
|
13
13
|
from allianceauth.services.tasks import QueueOnce
|
14
|
-
from app_utils.esi import
|
14
|
+
from app_utils.esi import retry_task_on_esi_error_and_offline
|
15
15
|
from app_utils.logging import LoggerAddTag
|
16
16
|
|
17
17
|
from killtracker import __title__
|
@@ -116,7 +116,6 @@ def run_tracker(
|
|
116
116
|
self: Task, tracker_pk: int, killmail_id: int, ignore_max_age: bool = False
|
117
117
|
) -> None:
|
118
118
|
"""Run tracker for given killmail and trigger sending if needed."""
|
119
|
-
retry_task_if_esi_is_down(self)
|
120
119
|
tracker: Tracker = Tracker.objects.get_cached(
|
121
120
|
pk=tracker_pk,
|
122
121
|
select_related="webhook",
|
@@ -128,9 +127,11 @@ def run_tracker(
|
|
128
127
|
logger.error("Aborting. %s", ex)
|
129
128
|
return
|
130
129
|
|
131
|
-
|
132
|
-
|
133
|
-
|
130
|
+
with retry_task_on_esi_error_and_offline(self, f"Tracker {tracker}"):
|
131
|
+
killmail_new = tracker.process_killmail(
|
132
|
+
killmail=killmail, ignore_max_age=ignore_max_age
|
133
|
+
)
|
134
|
+
|
134
135
|
if killmail_new:
|
135
136
|
logger.info("%s: Killmail %d matches", tracker, killmail_id)
|
136
137
|
killmail_new.save()
|
@@ -142,7 +143,6 @@ def run_tracker(
|
|
142
143
|
@shared_task(bind=True, max_retries=None)
|
143
144
|
def generate_killmail_message(self: Task, tracker_pk: int, killmail_id: int) -> None:
|
144
145
|
"""Generate and enqueue message from given killmail and start sending."""
|
145
|
-
retry_task_if_esi_is_down(self)
|
146
146
|
tracker: Tracker = Tracker.objects.get_cached(
|
147
147
|
pk=tracker_pk,
|
148
148
|
select_related="webhook",
|
@@ -166,7 +166,7 @@ def generate_killmail_message(self: Task, tracker_pk: int, killmail_id: int) ->
|
|
166
166
|
)
|
167
167
|
raise self.retry(
|
168
168
|
max_retries=KILLTRACKER_GENERATE_MESSAGE_MAX_RETRIES,
|
169
|
-
|
169
|
+
retry_backoff=KILLTRACKER_GENERATE_MESSAGE_RETRY_COUNTDOWN,
|
170
170
|
exc=ex,
|
171
171
|
)
|
172
172
|
|
@@ -47,8 +47,7 @@ class TestTasksEnd2End(NoSocketsTestCase):
|
|
47
47
|
def setUp(self):
|
48
48
|
cache.clear()
|
49
49
|
|
50
|
-
|
51
|
-
def test_normal_case(self, requests_mocker, mock_execute):
|
50
|
+
def test_normal_case(self, mock_execute, requests_mocker):
|
52
51
|
# given
|
53
52
|
mock_execute.return_value = dhooks_lite.WebhookResponse({}, status_code=200)
|
54
53
|
requests_mocker.register_uri(
|
@@ -71,28 +70,3 @@ class TestTasksEnd2End(NoSocketsTestCase):
|
|
71
70
|
_, kwargs = mock_execute.call_args_list[1]
|
72
71
|
self.assertIn("My Tracker", kwargs["content"])
|
73
72
|
self.assertIn("10000002", kwargs["embeds"][0].url)
|
74
|
-
|
75
|
-
@patch(PACKAGE_PATH + ".tasks.retry_task_if_esi_is_down")
|
76
|
-
def test_should_retry_when_esi_error_limit_reached(
|
77
|
-
self, requests_mocker, mock_retry_task_if_esi_is_down, mock_execute
|
78
|
-
):
|
79
|
-
def my_retry_task_if_esi_is_down(task):
|
80
|
-
"""Retry the task one time only."""
|
81
|
-
if task.request.retries < 1:
|
82
|
-
raise task.retry()
|
83
|
-
|
84
|
-
# given
|
85
|
-
mock_execute.return_value = dhooks_lite.WebhookResponse({}, status_code=200)
|
86
|
-
mock_retry_task_if_esi_is_down.side_effect = my_retry_task_if_esi_is_down
|
87
|
-
requests_mocker.register_uri(
|
88
|
-
"GET",
|
89
|
-
_ZKB_REDISQ_URL,
|
90
|
-
[
|
91
|
-
{"status_code": 200, "json": {"package": killmails_data()[10000001]}},
|
92
|
-
{"status_code": 200, "json": {"package": None}},
|
93
|
-
],
|
94
|
-
)
|
95
|
-
# when
|
96
|
-
tasks.run_killtracker.delay()
|
97
|
-
# then
|
98
|
-
self.assertEqual(mock_execute.call_count, 1)
|
killtracker/tests/test_tasks.py
CHANGED
@@ -205,7 +205,6 @@ class TestRunKilltracker(TestTrackerBase):
|
|
205
205
|
self.assertFalse(mock_delete_stale_killmails.delay.called)
|
206
206
|
|
207
207
|
|
208
|
-
@patch(MODULE_PATH + ".retry_task_if_esi_is_down", lambda x: None)
|
209
208
|
@patch(MODULE_PATH + ".send_messages_to_webhook", spec=True)
|
210
209
|
@patch(MODULE_PATH + ".generate_killmail_message", spec=True)
|
211
210
|
class TestRunTracker(TestTrackerBase):
|
@@ -257,7 +256,6 @@ class TestRunTracker(TestTrackerBase):
|
|
257
256
|
self.assertTrue(mock_send_messages_to_webhook.delay.called)
|
258
257
|
|
259
258
|
|
260
|
-
@patch(MODULE_PATH + ".retry_task_if_esi_is_down", lambda x: None)
|
261
259
|
@patch(MODULE_PATH + ".generate_killmail_message.retry", spec=True)
|
262
260
|
@patch(MODULE_PATH + ".send_messages_to_webhook", spec=True)
|
263
261
|
class TestGenerateKillmailMessage(TestTrackerBase):
|
File without changes
|
File without changes
|