zappa / Zappa

Serverless Python
https://zappa.ws/zappa
MIT License
3.24k stars 362 forks source link

Changing batch size in SQS event does not actually change the batch size off SQS trigger #1343

Open lmuther8 opened 1 month ago

lmuther8 commented 1 month ago

Context

I was updating a SQS event batch size with the zappa settings and assumed it had worked and did not even check the console to make sure. Later I was testing another function that invoked the previous one and in doing so I noticed the batch size was not increased.

Expected Behavior

I changed the batch size in the zappa settings from 1 > 5 and the SQS trigger batch size should change from 1 > 5.

Old Settings:

{
    "function": "app.lambda_handler",
    "event_source": {
        "arn": "arn:aws:sqs:us-west-2:1........",
        "batch_size": 1,
        "enabled": true
    }
}

New Settings:

{
    "function": "app.lambda_handler",
    "event_source": {
        "arn": "arn:aws:sqs:us-west-2:1........",
        "batch_size": 5,
        "enabled": true
    }
}

Actual Behavior

Nothing happens.

Steps to Reproduce

  1. Create a deployment with an SQS event with a batch size of 1.
  2. Change the batch size to 5 and update the function.
  3. Check AWS console to see the batch size has not changed.

Your Environment

lmuther8 commented 1 month ago

Line 2885 and 2886 in zappa/core.py:

elif rule_response == "exists":
    print("{} event schedule for {} already exists - Nothing to do here.".format(svc, function))

rule_response is returned from the function add_event_source from line 445 in zappa/utilities.py and that should maybe update the event source if it has changed and can return a status of updated when that happens.

lmuther8 commented 1 month ago

Also should add support for batch window and maximum concurrency