shouldn't you wait a little bit for the migration to be done?
directly checking and exiting right away looks a bit risky (and too fast) for me.

sleep 1 or 2 should be fine