# create_ingestion_lock

This lambda is responsible for finding or creating a lock file associated with the UPC of the Product that is being ingested.

## Rational

We want to handle scenarios where two DDEX deliveries for the same UPC are ingested at the same time. We need to make sure that in these cases we prevent updating metadata until the previous one is finished as this may cause undesired behaviour. 

## Business logic

This lambda will check if a lock file for a given UPC is present, else create it and continue the ingest. If a lock file is present, this lambda will throw an exception which will allow the state machine to retry up until a given timeout value as we do not want to instantly fail and instead wait for the lock file of an earlier ingest to be removed. 
