简体   繁体   English

有没有办法添加延迟以从 S3 上传触发 lambda?

[英]Is there a way to add delay to trigger a lambda from S3 upload?

I have a Lambda function which is triggered after put/post event of S3 bucket.我有一个 Lambda 函数,它在 S3 存储桶的放置/发布事件之后触发。 This works fine if there is only one file uploaded to S3 bucket.如果只有一个文件上传到 S3 存储桶,这可以正常工作。

However, at times there could be multiple files uploaded which can take upto 7 minutes to complete the upload process.但是,有时可能会上传多个文件,完成上传过程最多可能需要 7 分钟。 This triggers my lambda function multiple times which adds overhead of handling this from the code.这会多次触发我的 lambda 函数,这增加了从代码中处理它的开销。

Is there any way to either trigger the lambda only once for the complete upload or add delay in the function and avoid multiple execution of Lambda function?有什么方法可以只触发一次 lambda 以完成上传或在函数中添加延迟并避免多次执行 Lambda 函数?

There is no specific interval when the files will be uploaded to S3 hence could not use scheduler.文件上传到 S3 的时间没有特定的时间间隔,因此无法使用调度程序。

I have a Lambda function which is triggered after put/post event of S3 bucket.我有一个Lambda函数,该函数在S3存储桶的put / post事件后触发。 This works fine if there is only one file uploaded to S3 bucket.如果只有一个文件上传到S3存储桶,则此方法可以正常工作。

However, at times there could be multiple files uploaded which can take upto 7 minutes to complete the upload process.但是,有时可能会上传多个文件,最多可能需要7分钟才能完成上传过程。 This triggers my lambda function multiple times which adds overhead of handling this from the code.这会多次触发我的lambda函数,从而增加了从代码中处理该函数的开销。

Is there any way to either trigger the lambda only once for the complete upload or add delay in the function and avoid multiple execution of Lambda function?有什么方法可以仅触发一次lambda来完成完整上传,还是可以在函数中添加延迟并避免多次执行Lambda函数?

There is no specific interval when the files will be uploaded to S3 hence could not use scheduler.没有将文件上载到S3的特定间隔,因此无法使用调度程序。

I have a Lambda function which is triggered after put/post event of S3 bucket.我有一个Lambda函数,该函数在S3存储桶的put / post事件后触发。 This works fine if there is only one file uploaded to S3 bucket.如果只有一个文件上传到S3存储桶,则此方法可以正常工作。

However, at times there could be multiple files uploaded which can take upto 7 minutes to complete the upload process.但是,有时可能会上传多个文件,最多可能需要7分钟才能完成上传过程。 This triggers my lambda function multiple times which adds overhead of handling this from the code.这会多次触发我的lambda函数,从而增加了从代码中处理该函数的开销。

Is there any way to either trigger the lambda only once for the complete upload or add delay in the function and avoid multiple execution of Lambda function?有什么方法可以仅触发一次lambda来完成完整上传,还是可以在函数中添加延迟并避免多次执行Lambda函数?

There is no specific interval when the files will be uploaded to S3 hence could not use scheduler.没有将文件上载到S3的特定间隔,因此无法使用调度程序。

An alternative might be to have your Lambda function check for existence of all required files before moving on to the action you need to take.另一种方法可能是让您的 Lambda 函数在继续执行您需要采取的操作之前检查是否存在所有必需的文件。 The Lambda function would still fire each time, but would exit quickly if not all files have been received yet. Lambda 函数每次仍会触发,但如果尚未收到所有文件,则会快速退出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM