All Products
Search
Document Center

Function Compute:How do I prevent loops from being triggered?

Last Updated:Feb 01, 2024

In some cases, when files are uploaded to an Object Storage Service (OSS) bucket, a function is triggered. When the function processes events, one or more files are generated and written to the buckets. This triggers the function, which results in an infinite loop.

To resolve the issue, make sure that functions are not infinitely recursive, such as the function that is described in the preceding example. For example, if your function is triggered by uploading files to the src/ directory in the bucket, you can configure the function to write files to the dst/ directory. This prevents the files generated by the function from triggering the function again.