An indeterminate number of images will be attached to Lead records. We have a requirement that 5 minutes after the last image is attached, the Lead owner should automatically receive an email.
I've thought of one approach to this: Every time an image is attached to a Lead record, schedule a job to happen 5 minutes later. When the job executes 5 minutes later, check for images uploaded in the last five minutes and/or for more similar pending jobs. If anything is found, do nothing. If nothing is found, send the email.
But I expect this could burn through our async limits pretty quickly (assuming there are a lot of leads and many images are uploaded.
Is there a better way to approach this?