GoogleCloudPlatform / serverless-photosharing-workshop

This is the code for the Pic-a-daily, an application to upload, analyse and share pictures using Google Cloud serverless solutions, namely Cloud Functions, App Engine, and Cloud Run
https://codelabs.developers.google.com/serverless-workshop/
Apache License 2.0
77 stars 43 forks source link

Add a `processed` flag to the Firestore documents to indicate the thumbnail was created #5

Closed glaforge closed 4 years ago

glaforge commented 4 years ago

The collage service might run at the same time the thumbnail service is running. So there's a very short period of time where collage could try to fetch the thumbnail picture from Cloud Storage but it's not there yet. With an extra processed boolean value in the Firestore document schema, we could ensure the collage service only picks pictures that already have their thumbnails generated.

glaforge commented 4 years ago

Commit https://github.com/GoogleCloudPlatform/serverless-photosharing-workshop/commit/c6ee854c2f4482837c862ad3ca38f7b522fbb8f1 fixes this, adding a thumbnail flag in the Firestore document that is false when the thumbnail hasn't yet been created by the thumbnail service, or true if it's been created.