Avoid race condition for CDN uploads
Avoid race condition for CDN uploads

Parallel CDN uploads were failing on a missing `s3_object.exists?`
method inside a parallel block. The shared code appears to be the
`bucket.objects[]` method. Wrap that call in a Mutex.synchronize to
avoid conflicts. This should not slow things down appreciably and in my
testing it eliminated this failure mode.

Change-Id: Id99a2ead0d6c2b431b82aa84782af51062f294ff
Reviewed-on: https://gerrit.instructure.com/79645
Reviewed-by: Rob Orton <7e09c9d3e96378bf549fc283fd6e1e5b7014cc33@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>
QA-Review: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>

fronteerio/canvas-lms,fronteerio/canvas-lms,SwinburneOnline/canvas-lms,HotChalk/canvas-lms,sfu/canvas-lms,sfu/canvas-lms,HotChalk/canvas-lms,venturehive/canvas-lms,fronteerio/canvas-lms,HotChalk/canvas-lms,venturehive/canvas-lms,djbender/canvas-lms,SwinburneOnline/canvas-lms,grahamb/canvas-lms,venturehive/canvas-lms,SwinburneOnline/canvas-lms,sfu/canvas-lms,grahamb/canvas-lms,grahamb/canvas-lms,sfu/canvas-lms,grahamb/canvas-lms,grahamb/canvas-lms,djbender/canvas-lms,HotChalk/canvas-lms,roxolan/canvas-lms,sfu/canvas-lms,venturehive/canvas-lms,djbender/canvas-lms,sfu/canvas-lms,djbender/canvas-lms,roxolan/canvas-lms,roxolan/canvas-lms,SwinburneOnline/canvas-lms,fronteerio/canvas-lms,sfu/canvas-lms,roxolan/canvas-lms