mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(lambda): default event source mapping BatchSize by source type (#5362)
CreateEventSourceMapping stored BatchSize 10 for every event source when the request omitted it. The Lambda model documents a per-source default: 10 for SQS and 100 for Kinesis, DynamoDB Streams, Amazon MSK, self-managed Apache Kafka, Amazon MQ and DocumentDB. SQS mappings keep 10; every other source now defaults to 100. updateEventSourceMapping_invalidLaterField_leavesBatchSizeAndEnabledUnchanged asserted the untouched Kafka mapping kept the old default of 10; it now expects 100. Fixes #4740
This commit is contained in:
1 parent
1082941bc2
commit
29319fbfb5
3 files changed
+42
-2
No files matched your search
@@ -97,6 +97,8 @@ public class LambdaService implements ResourceProvider {
|
||||
private static final Pattern S3_BUCKET_PATTERN = Pattern.compile("[0-9A-Za-z\\.\\-_]*(?<!\\.)");
|
||||
// Create/UpdateAlias FunctionVersion (VersionWithLatestPublished: 1-1024, pattern below) and Description (max 256).
|
||||
private static final Pattern ALIAS_FUNCTION_VERSION_PATTERN = Pattern.compile("(\\$LATEST(\\.PUBLISHED)?|[0-9]+)");
|
||||
private static final int DEFAULT_SQS_BATCH_SIZE = 10;
|
||||
private static final int DEFAULT_STREAM_BATCH_SIZE = 100;
|
||||
// The model's own Role pattern, which AWS quotes verbatim in its validation message; it
|
||||
// already accepts every partition.
|
||||
private static final Pattern ROLE_ARN_PATTERN = Pattern.compile(
|
||||
@@ -1506,7 +1508,10 @@ public class LambdaService implements ResourceProvider {
|
||||
|
||||
ResolvedFunctionTarget target = resolveFunctionTarget(resolvedRegion, fnRef);
|
||||
|
||||
int batchSize = toInt(request.get("BatchSize"), 10);
|
||||
// The model documents a per-source default: 10 for SQS, 100 for every other source type.
|
||||
int defaultBatchSize = eventSourceArn != null && eventSourceArn.contains(":sqs:")
|
||||
? DEFAULT_SQS_BATCH_SIZE : DEFAULT_STREAM_BATCH_SIZE;
|
||||
int batchSize = toInt(request.get("BatchSize"), defaultBatchSize);
|
||||
Integer maximumBatchingWindowInSeconds = parseMaximumBatchingWindow(request);
|
||||
boolean enabled = !Boolean.FALSE.equals(request.get("Enabled"));
|
||||
|
||||
|
||||
Reference in new issue
Block a user