@@ -1081,7 +1081,8 @@ def restore(self):
10811081 # thus we need to parse the POST request ourselves which is a bit of a pain
10821082 # read the first chunk and separate the POST header from the body
10831083 # we parse the header and store the first part of the body as chunk
1084- chunk_size = 16 * 1024
1084+ print_err ("Restore: processing POST" )
1085+ chunk_size = 128 * 1024
10851086 chunk = request .stream .read (chunk_size )
10861087 split = chunk .split (b"\r \n \r \n " , 1 )
10871088 if len (split ) != 2 :
@@ -1112,16 +1113,25 @@ def restore(self):
11121113 shutil .rmtree (restore_path , ignore_errors = True )
11131114 restore_path .mkdir (mode = 0o644 , exist_ok = True )
11141115
1116+ received_bytes = 0
1117+ next_progress = time .time () + 5
1118+
11151119 with open (restore_path / filename , "bw" ) as f :
11161120 # this while loop looks backwards but it's not because we start with the first chunk
11171121 # we read further up in this function
11181122 while True :
11191123 if len (chunk ) == 0 :
11201124 break
1125+
1126+ received_bytes += len (chunk )
1127+ if time .time () > next_progress :
1128+ next_progress = time .time () + 5
1129+ print_err (f"Restore: upload progress: { round (received_bytes / (1024 * 1024 ))} MB" )
1130+
11211131 f .write (chunk )
11221132 chunk = request .stream .read (chunk_size )
11231133
1124- print_err (f"saved restore file to { restore_path / filename } " )
1134+ print_err (f"Restore: saved file to { restore_path / filename } " )
11251135 return redirect (url_for ("executerestore" , zipfile = filename ))
11261136 else :
11271137 return render_template ("/restore.html" )
0 commit comments