Saturday, 15 August 2020

Is it too much of requests?

I'm uploading post images to S3 using this method, I feel like I'm using too much of request.My post can contain multiple images and post document should have an array of uploaded images list, Image list that post.I store post document data on NoSQL database and post related images on AWS S3This how my application worksWhen a user creates a post and clicks publish buttonFirst I send post data to the server and save the post document on DB and return the post idwhen post id returns application will start uploading the imagessend a request to the server and return the presigned URLupload the image using the presigned URLafter the upload is successful again send a request to the server and add the uploaded image URL to post image list array.one by one image will upload to S3Why I don't save the image URL on the post document on the first stage while getting the presigned URL? what if I saved the post image URL on post document on the first stage and uploading image to S3 fails, that why I send another request to the server to save the image URL after image successfully uploaded.My question, Is this the way peoples do? or any other way?Thank You!

Submitted August 15, 2020 at 04:06PM by Chawki_

No comments:

Post a Comment