If the disk status is OK the upload was finished, so we should break, no?
If the disk status is LOCKED, we should continue. But in this case there is
no point to check the transfer again.
What if the finalize failed, and the disk was deleted? Do we get disk = None
or some exception?
Is this error possible? We need to add debug log here.
I think the logic should be:
while True:
wait
get transfer
if transfer does not exists (None or sdk.NotFoundErro) , break
if transfer is finished, break (success)
if transfer is finalizing:
if timed out, fail
continue
fail with invalid transfer phase
while True:
wait
get disk
if disk does not exists (None or sdk.NotFoundErro), fail
if disk is OK, break (success)
if disk is locked:
if timed out, fail
continue
fail with invalid disk status
This is little bit crazy that all user have to do this.
We need to change engine so transfer is kept in the database after it finished for enough
time (1 hour?), so user can wait *only* for the transfer.
Nir