lookit / lookit-api

Codebase for Lookit v2 and Experimenter v2. Includes an API. Docs: http://lookit.readthedocs.io/
https://lookit.mit.edu/
MIT License
10 stars 18 forks source link

Fix video deletion process #1430

Closed becky-gilbert closed 1 month ago

becky-gilbert commented 1 month ago

Summary

Our video deletion system is not working because the video is deleted from the DB first, and then from S3, but the S3 deletion code tries to get the (now deleted) video object from the DB (#1423). The fix should be straightforward.

Proposed changes

There are (at least) two ways of solving this problem:

  1. Delete the video from the database and from S3 at the same time. In order to keep the 7 day 'soft delete' system, we would use the delayed task to delete both the video DB object and S3 file at the same time.
  2. Pass the video file namerecording type into the delayed S3 deletion task, so that this task does not need to access the (since deleted) video object from the database just to get the filenamerecording type (for selecting the S3 bucket).

Update: I'm going to implement the 2nd approach. Deleting the video objects from the DB immediately means that the site will not show evidence of those videos anymore (e.g. in the researcher responses pages, in the participant's history pages). Thus the user will immediately see the effects of the delete action. At that point it should be obvious to users if the delete action was a mistake, and they'll still have a short buffer period in which they can reach out to us to recover anything from S3 that shouldn't have been deleted.