Skip to content

Commit 2f897d1

Browse files
committed
Remove update exception and create() new EsmWorker instead of start()
1 parent 7eb895a commit 2f897d1

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

localstack-core/localstack/services/lambda_/event_source_mapping/esm_worker.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,6 @@ def start(self):
103103
)
104104
self._poller_thread.start()
105105

106-
def update(self):
107-
with self._state_lock:
108-
self.current_state = EsmState.UPDATING
109-
self.state_transition_reason = self.user_state_reason
110-
self.start()
111-
112106
def stop(self):
113107
with self._state_lock:
114108
self.enabled = False

localstack-core/localstack/services/lambda_/provider.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,9 +2155,6 @@ def update_event_source_mapping_v2(
21552155
"The resource you requested does not exist.", Type="User"
21562156
) # TODO: test?
21572157

2158-
if old_event_source_mapping["State"] == EsmState.UPDATING:
2159-
raise ResourceConflictException("Already updating", Type="User")
2160-
21612158
# normalize values to overwrite
21622159
event_source_mapping = old_event_source_mapping | request_data
21632160

@@ -2202,7 +2199,8 @@ def update_event_source_mapping_v2(
22022199

22032200
# We should stop() the worker since the delete() will remove the ESM from the state mapping.
22042201
esm_worker.stop()
2205-
updated_esm_worker.start()
2202+
# This will either create an EsmWorker in the CREATING state if enabled. Otherwise, the DISABLING state is set.
2203+
updated_esm_worker.create()
22062204

22072205
return {**event_source_mapping, **temp_params}
22082206

0 commit comments

Comments
 (0)