OpenNewsLabs / autoEdit_2

Fast text based video editing, node Electron Os X desktop app, with Backbone front end.
https://opennewslabs.github.io/autoEdit_2/
MIT License
419 stars 56 forks source link

Race condition in `interative_transcription_generator` callbacks for transcription, metadata, and video preview #53

Closed pietrop closed 6 years ago

pietrop commented 6 years ago

Sometimes, a transcription finishes to process in the transcription list UI and when you click, it does not take you to the transcription page, and in the console it shows an error saying the filename in metadata is not defined.

But then if you leave it enough time, after a bit you are able to click again and be taken to the transcription page.

In this scenario it seems to be because in db.js the callbacks from theinterative_transcription_generator returning a transcription, the metadata info, and a video preview file, might not happen the order one would expect. Eg reading the metadata might take longer etc.. And the transcription callback is the one setting the transcription status to true to mark it as done. Which as a result makes the transcription in the transcription list clickable.


One possible solution is to add a few extra status attributes for the individual callbacks to the transcription json model.

eg with default values

metadataStatus = false
videoStatus = false
transcriptionStatus = false

Then in "pseudocode" for transcription calllback

if metadataStatus == true && videoStatus == true
transcriptionStatus = true

for video preview callback

if metadataStatus == true && transcriptionStatus == true
videoStatus = true

for metadata read callback

if transcriptionStatus == true && videoStatus == true
metadataStatus = true
pietrop commented 6 years ago

initially mentioned as #51

pietrop commented 6 years ago

added this, tested, seem to work. in this commit https://github.com/OpenNewsLabs/autoEdit_2/commit/5c773a7f32a073f2aec12ddcaaba1a0e8af74dc6