Sketchup freezes when uploading a file to the cloud

I make a request from ruby api to upload the exported model to my cloud using this code

req = Net::HTTP::Post.new(url.path)
req.content_type = ‘multipart/form-data; boundary=’ + boundary
req.body_stream = post_stream
http = Net::HTTP.new(url.host, url.port)
res = http.start {|http| http.request(req) }

Here is only some peace of code but actually it works normally and my exported .obj file is uploaded normally. The probolem is when the upload starts Sketchup freezes and becomes not responding.
Is there a way(maybe using a separate thread) to avoid from freezing?
In my case it is ok to show some loading during upload, but not freezing.
Thanks in advance.

Most likely not. Ruby freezes while waiting for the http.request to complete, and when Ruby freezes, SketchUp freezes. At this point Ruby threads in SketchUp are not genuine threads; they are simulated by the interpreter and can still block.