SAM Lambda max concurrency не работает, 2 лямбда-функции перекрываются - PullRequest
0 голосов
/ 04 августа 2020

У меня есть функция Node Lambda на основе SAM, настроенная так:

exports.lambdaHandler = async (event, context) => {
    await axios.get('https://xxxxxxxx.ngrok.io').then(() => {
        response = {
            'statusCode': 200,
            'body': JSON.stringify({
                message: 'hello world',
                // location: ret.data.trim()
            })
        };

        return response;
    });
};

Шаблон для этого выглядит так:

Resources:
  ScheduledEventLogger:
    Type: AWS::Serverless::Function
    Properties:
      Description: A Lambda function that logs the payload of messages sent to an associated SQS queue.
      Runtime: nodejs12.x
      Handler: hello-world/app.testFunction
      ReservedConcurrentExecutions: 1
      Events:
        CloudWatchEvent:
          Type: Schedule
          Properties:
            Schedule: rate(1 minute)
      MemorySize: 128
      Timeout: 100

Другой конец ссылки ngrok выглядит так: :

router
    .route('/')
    .get((req, res) => {
        console.log("Started");

        setTimeout(function(){ console.log("DONE 70 Seconds"); }, 70000);

        res.sendStatus(200);
    });

Из-за ReservedConcurrentExecutions я ожидал, что журнал консоли будет выглядеть так:

Started
DONE 70 Seconds
Started

Однако результат был:

Started
Started
DONE 70 Seconds

Как могу ли я предотвратить это перекрытие двух функций? Похоже, что Reserved мне не подходит, или я сделал это неправильно.

...