This looks like you’re checking if the task was complete immediately after creating the task. This will certainly return false.
You can set up a while loop to check if the task is complete, but that will hang up any caller waiting for a response from your api. If you’re using this on the client side, I often set up a time to check the status on task, on a routine.