Skip to content

Commit fc60200

Browse files
committed
fix: passing in attributes to exception
1 parent 451ce15 commit fc60200

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,12 @@ def poller_loop(self, *args, **kwargs):
158158
poll_interval_duration = POLL_INTERVAL_SEC
159159
except EmptyPollResultsException as miss_ex:
160160
# If the event source is empty, backoff
161-
poll_miss_boff_duration = empty_boff.next_backoff()
161+
poll_interval_duration = empty_boff.next_backoff()
162162
LOG.debug(
163-
"The event source %s is empty. Backing off for for %s seconds until next request.",
163+
"The event source %s is empty. Backing off for %s seconds until next request.",
164164
miss_ex.source_arn,
165-
poll_miss_boff_duration,
165+
poll_interval_duration,
166166
)
167-
poll_interval_duration = empty_boff.next_backoff()
168167
except Exception as e:
169168
LOG.error(
170169
"Error while polling messages for event source %s: %s",

localstack-core/localstack/services/lambda_/event_source_mapping/pollers/poller.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ class EmptyPollResultsException(Exception):
1919
service: str
2020
source_arn: str
2121

22-
def __init__(self, *args, service: str = "", source_arn: str = ""):
23-
super(EmptyPollResultsException, self).__init__(*args)
22+
def __init__(self, service: str = "", source_arn: str = ""):
23+
self.service = service
24+
self.source_arn = source_arn
2425

2526

2627
class PipeStateReasonValues(PipeStateReason):

localstack-core/localstack/services/lambda_/event_source_mapping/pollers/sqs_poller.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,7 @@ def poll_events(self) -> None:
133133
exc_info=LOG.isEnabledFor(logging.DEBUG),
134134
)
135135
else:
136-
raise EmptyPollResultsException(
137-
"No results found in poll call to SQS",
138-
service="sqs",
139-
source_arn=self.source_arn,
140-
)
136+
raise EmptyPollResultsException(service="sqs", source_arn=self.source_arn)
141137

142138
def handle_messages(self, messages):
143139
polled_events = transform_into_events(messages)

0 commit comments

Comments
 (0)