freerange/jam-coop

Possible race condition trying to transcode files before the direct upload to S3 has completed (`Aws::S3::Errors::NoSuchKey`)

Opened this issue · 0 comments

See this exception.

I think this is most likely a race condition where the track has been saved and so the relevant TranscodeJobs have been queued in the after_save callback on Track. However, the direct upload of the original WAV file for the track hasn't yet completed. Thus when the TranscodeJob tries to fetch the file from S3, we see these Aws::S3::Errors::NoSuchKey exceptions. Since there were only two occurrences each for different TranscodeJob IDs, I suspect they were both retried and succeeded the 2nd time round.

I wonder whether we could use the direct-upload:end or direct-uploads:end Direct Upload JavaScript Events to send an XHR request to the Rails app to indicate that the relevant file is available in S3...?