A stab at #677 - it seems to act as expected - but as I can't produce a race condition ad-hoc, I can't guarantee it works
Added timeout loop and changed directory of tempfile
Add a sleep to the loop
Added exception rescue
Merge pull request #696 from concerto/background_migrations

A stab at #677 - it seems to act as expected