Quota size check to not be exceeded

Sorry for not clarifying.
I want to dynamically get the size remaining of my remote server (I will do it manually by having a file that writes the disk size left of the server----Duplicati will read this file to get this size).
–quota-size is static

I am thinking an implementation which I will add a new variable -not sure where yet as I am brainstorming.

....
while(1){
  file_to_be_uploaded = get_file_from_ready_to_upload_queue)
  if(size_left is not defined)
    size_left = get_KB_left_from_server()
  If (size(file_to_be_uploaded) > size_left)
     Dont upload the file and stop the backup
  else
    Push the file to the upload queue
}
......

I thought a process represents one thread(Only one instance runs the code block that takes the files ready to be uploaded and inserts them to the queue). That is my understanding of the explanation below.

My thought was to add the psuedocode I provided before to the phase A `process` caps the number of active uploads, given that only one process-thread does this job to avoid race condition.
Are there any misconceptions to my interprentation?