Issue with Dronekit-Python function vehicle.commands.upload()

I am currently working on path planning and obstacle avoidance using Dronekit-Python as my offboard API on Gazebo(PX4-SITL). I am facing an issue with uploading commands using vehicle.command.upload() function (Dronekit) because I have to upload commands during the flight (realtime) and upload function takes approximately 0.1 second to upload a single command. I am uploading approximately 30 commands at a time and it takes 2.8 seconds (approx) and while uploading the drone stop (loiters) which is degrading the performance of the algorithm (you cannot afford to stop while avoiding the obstacles). Is there any way that I can reduce the vehicle.commands.upload() time ?