Commit 454c368
committed
Prevent UI thread from blocking during batch upload
The `batchUploadFiles` call does not report back a response
until all uploads are completed. To do this, it calls sleep(1)
while it waits for (1) everything to finish, (2) a cancel request,
or (3) all uploads to finish.
The calls to sleep(1) are made inside a `setResponseBlock` handler
that is not passed a `queue` parameter. Because the queue isn't
specified, it runs on the main thread. This causes apps that call
this function to freeze on their main thread for a second.
This patch makes a dedicated NSOperationQueue for monitoring the
progress.1 parent f47e528 commit 454c368
File tree
3 files changed
+9
-2
lines changed3 files changed
+9
-2
lines changedLines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
384 | | - | |
| 384 | + | |
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
| |||
423 | 423 | | |
424 | 424 | | |
425 | 425 | | |
426 | | - | |
| 426 | + | |
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
| |||
0 commit comments