localstack-core 4.12.1.dev83__py3-none-any.whl → 4.12.1.dev85__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.
- localstack/services/events/provider.py +35 -7
- localstack/version.py +2 -2
- {localstack_core-4.12.1.dev83.dist-info → localstack_core-4.12.1.dev85.dist-info}/METADATA +1 -1
- {localstack_core-4.12.1.dev83.dist-info → localstack_core-4.12.1.dev85.dist-info}/RECORD +12 -12
- {localstack_core-4.12.1.dev83.data → localstack_core-4.12.1.dev85.data}/scripts/localstack +0 -0
- {localstack_core-4.12.1.dev83.data → localstack_core-4.12.1.dev85.data}/scripts/localstack-supervisor +0 -0
- {localstack_core-4.12.1.dev83.data → localstack_core-4.12.1.dev85.data}/scripts/localstack.bat +0 -0
- {localstack_core-4.12.1.dev83.dist-info → localstack_core-4.12.1.dev85.dist-info}/WHEEL +0 -0
- {localstack_core-4.12.1.dev83.dist-info → localstack_core-4.12.1.dev85.dist-info}/entry_points.txt +0 -0
- {localstack_core-4.12.1.dev83.dist-info → localstack_core-4.12.1.dev85.dist-info}/licenses/LICENSE.txt +0 -0
- {localstack_core-4.12.1.dev83.dist-info → localstack_core-4.12.1.dev85.dist-info}/plux.json +0 -0
- {localstack_core-4.12.1.dev83.dist-info → localstack_core-4.12.1.dev85.dist-info}/top_level.txt +0 -0
|
@@ -172,6 +172,7 @@ from localstack.state import StateVisitor
|
|
|
172
172
|
from localstack.utils.common import truncate
|
|
173
173
|
from localstack.utils.event_matcher import matches_event
|
|
174
174
|
from localstack.utils.strings import long_uid
|
|
175
|
+
from localstack.utils.threads import start_worker_thread
|
|
175
176
|
from localstack.utils.time import TIMESTAMP_FORMAT_TZ, timestamp
|
|
176
177
|
from localstack.utils.xray.trace_header import TraceHeader
|
|
177
178
|
|
|
@@ -1903,13 +1904,19 @@ class EventsProvider(EventsApi, ServiceLifecycleHook):
|
|
|
1903
1904
|
# Always add the successful EventId entry, even if target processing might fail
|
|
1904
1905
|
processed_entries.append({"EventId": event_formatted["id"]})
|
|
1905
1906
|
|
|
1907
|
+
# Process rules asynchronously to match AWS behavior where put-events returns immediately
|
|
1906
1908
|
if configured_rules := list(event_bus.rules.values()):
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1909
|
+
start_worker_thread(
|
|
1910
|
+
self._process_rules_async,
|
|
1911
|
+
params={
|
|
1912
|
+
"rules": configured_rules,
|
|
1913
|
+
"region": region,
|
|
1914
|
+
"account_id": account_id,
|
|
1915
|
+
"event_formatted": event_formatted,
|
|
1916
|
+
"trace_header": trace_header,
|
|
1917
|
+
},
|
|
1918
|
+
name="events-process-rules",
|
|
1919
|
+
)
|
|
1913
1920
|
else:
|
|
1914
1921
|
LOG.info(
|
|
1915
1922
|
json.dumps(
|
|
@@ -1926,6 +1933,27 @@ class EventsProvider(EventsApi, ServiceLifecycleHook):
|
|
|
1926
1933
|
# only required for EventStudio to capture input event if no rule is configured
|
|
1927
1934
|
pass
|
|
1928
1935
|
|
|
1936
|
+
def _process_rules_async(self, params: dict) -> None:
|
|
1937
|
+
"""Process rules asynchronously in a background thread.
|
|
1938
|
+
|
|
1939
|
+
TODO: Use a worker pool (similar to SNS) instead of spawning a new thread
|
|
1940
|
+
for each request to improve performance and resource management.
|
|
1941
|
+
"""
|
|
1942
|
+
rules = params["rules"]
|
|
1943
|
+
region = params["region"]
|
|
1944
|
+
account_id = params["account_id"]
|
|
1945
|
+
event_formatted = params["event_formatted"]
|
|
1946
|
+
trace_header = params["trace_header"]
|
|
1947
|
+
|
|
1948
|
+
for rule in rules:
|
|
1949
|
+
if rule.schedule_expression:
|
|
1950
|
+
# we do not want to execute Scheduled Rules on PutEvents
|
|
1951
|
+
continue
|
|
1952
|
+
|
|
1953
|
+
# TODO: Process each rule asynchronously instead of sequentially to further
|
|
1954
|
+
# improve performance when multiple rules need to be evaluated.
|
|
1955
|
+
self._process_rules(rule, region, account_id, event_formatted, trace_header)
|
|
1956
|
+
|
|
1929
1957
|
def _process_rules(
|
|
1930
1958
|
self,
|
|
1931
1959
|
rule: Rule,
|
|
@@ -1983,7 +2011,7 @@ class EventsProvider(EventsApi, ServiceLifecycleHook):
|
|
|
1983
2011
|
)
|
|
1984
2012
|
)
|
|
1985
2013
|
else:
|
|
1986
|
-
LOG.
|
|
2014
|
+
LOG.debug(
|
|
1987
2015
|
json.dumps(
|
|
1988
2016
|
{
|
|
1989
2017
|
"InfoCode": "InternalInfoEvents at matches_rule",
|
localstack/version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '4.12.1.
|
|
32
|
-
__version_tuple__ = version_tuple = (4, 12, 1, '
|
|
31
|
+
__version__ = version = '4.12.1.dev85'
|
|
32
|
+
__version_tuple__ = version_tuple = (4, 12, 1, 'dev85')
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -4,7 +4,7 @@ localstack/deprecations.py,sha256=-3IYgCd6LEC3PjO7hbr3Dg-p0PIS6phjmv1qZnj1uo0,15
|
|
|
4
4
|
localstack/openapi.yaml,sha256=jFUzv-NKkJttxb8HRrmKiNYOmJD-zVfPxG3DDMrRwfg,30865
|
|
5
5
|
localstack/plugins.py,sha256=BIJC9dlo0WbP7lLKkCiGtd_2q5oeqiHZohvoRTcejXM,2457
|
|
6
6
|
localstack/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
localstack/version.py,sha256
|
|
7
|
+
localstack/version.py,sha256=-4tgatleS5OjJAhZfjhKe-HDW7Zbq3j5IhGy-ZVELik,721
|
|
8
8
|
localstack/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
localstack/aws/accounts.py,sha256=102zpGowOxo0S6UGMpfjw14QW7WCLVAGsnFK5xFMLoo,3043
|
|
10
10
|
localstack/aws/app.py,sha256=n9bJCfJRuMz_gLGAH430c3bIQXgUXeWO5NPfcdL2MV8,5145
|
|
@@ -450,7 +450,7 @@ localstack/services/events/connection.py,sha256=O6-r8egH1nrTF195UwkMTP5oppPKInhO
|
|
|
450
450
|
localstack/services/events/event_bus.py,sha256=KVaQmsCQDQP6YCyABj0NHUhRhEeFM5lllJ7A7d5neIY,4136
|
|
451
451
|
localstack/services/events/event_rule_engine.py,sha256=7ffH10SrR6FTU_cg8x8NAofP6Rsd03vw8FXyUbzByXc,28291
|
|
452
452
|
localstack/services/events/models.py,sha256=Myw_uQU8SR20Hj6or2_92KaxciuzF1f0GpMAfboeoOY,9722
|
|
453
|
-
localstack/services/events/provider.py,sha256=
|
|
453
|
+
localstack/services/events/provider.py,sha256=FBa2gIwYLdoZxtG7QeCPtYcoYYu6dYy2TSXWCOONlKc,78033
|
|
454
454
|
localstack/services/events/replay.py,sha256=FcX5L89Gb-wNJwjdynPZYWT0TyHgRJLUKIoZ2OAW8NU,2958
|
|
455
455
|
localstack/services/events/rule.py,sha256=FNX-PfIFc-r2SGlb5DJc_IqZPCSxNnkmrzU3R9Y2lTg,10193
|
|
456
456
|
localstack/services/events/scheduler.py,sha256=nBx5g1CyNJQOLAyeNgGznc9A4sxREX1S6WnqbBc_YGc,4255
|
|
@@ -1313,13 +1313,13 @@ localstack/utils/server/tcp_proxy.py,sha256=y2NJAmvftTiAYsLU_8qe4W5LGqwUw21i90Pu
|
|
|
1313
1313
|
localstack/utils/xray/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1314
1314
|
localstack/utils/xray/trace_header.py,sha256=ahXk9eonq7LpeENwlqUEPj3jDOCiVRixhntQuxNor-Q,6209
|
|
1315
1315
|
localstack/utils/xray/traceid.py,sha256=GKO-R2sMMjlrH2UaLPXlQlZ6flbE7ZKb6IZMtMu_M5U,1110
|
|
1316
|
-
localstack_core-4.12.1.
|
|
1317
|
-
localstack_core-4.12.1.
|
|
1318
|
-
localstack_core-4.12.1.
|
|
1319
|
-
localstack_core-4.12.1.
|
|
1320
|
-
localstack_core-4.12.1.
|
|
1321
|
-
localstack_core-4.12.1.
|
|
1322
|
-
localstack_core-4.12.1.
|
|
1323
|
-
localstack_core-4.12.1.
|
|
1324
|
-
localstack_core-4.12.1.
|
|
1325
|
-
localstack_core-4.12.1.
|
|
1316
|
+
localstack_core-4.12.1.dev85.data/scripts/localstack,sha256=WyL11vp5CkuP79iIR-L8XT7Cj8nvmxX7XRAgxhbmXNE,529
|
|
1317
|
+
localstack_core-4.12.1.dev85.data/scripts/localstack-supervisor,sha256=nm1Il2d6ASyOB6Vo4CRHd90w7TK9FdRl9VPp0NN6hUk,6378
|
|
1318
|
+
localstack_core-4.12.1.dev85.data/scripts/localstack.bat,sha256=tlzZTXtveHkMX_s_fa7VDfvdNdS8iVpEz2ER3uk9B_c,29
|
|
1319
|
+
localstack_core-4.12.1.dev85.dist-info/licenses/LICENSE.txt,sha256=3PC-9Z69UsNARuQ980gNR_JsLx8uvMjdG6C7cc4LBYs,606
|
|
1320
|
+
localstack_core-4.12.1.dev85.dist-info/METADATA,sha256=C7OnJ6y9gostOPZu924g4fCx7oY5i4605ITzEnOJIpY,5941
|
|
1321
|
+
localstack_core-4.12.1.dev85.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
1322
|
+
localstack_core-4.12.1.dev85.dist-info/entry_points.txt,sha256=cqjkPRG7pBKzXiO_XKc5lQHhmFCeno2KPd8shKp5bnc,21011
|
|
1323
|
+
localstack_core-4.12.1.dev85.dist-info/plux.json,sha256=qJn5-k2e7jr7Ire-9jvZowvfneTjSlIIbnT9rmye0-8,22121
|
|
1324
|
+
localstack_core-4.12.1.dev85.dist-info/top_level.txt,sha256=3sqmK2lGac8nCy8nwsbS5SpIY_izmtWtgaTFKHYVHbI,11
|
|
1325
|
+
localstack_core-4.12.1.dev85.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{localstack_core-4.12.1.dev83.data → localstack_core-4.12.1.dev85.data}/scripts/localstack.bat
RENAMED
|
File without changes
|
|
File without changes
|
{localstack_core-4.12.1.dev83.dist-info → localstack_core-4.12.1.dev85.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{localstack_core-4.12.1.dev83.dist-info → localstack_core-4.12.1.dev85.dist-info}/top_level.txt
RENAMED
|
File without changes
|