Skip to content

Commit

Permalink
Delay sending files for a while if they're still being uploaded
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosuav committed Nov 29, 2024
1 parent ebe9d64 commit b9e0ac3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 0 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@
alert too?
* Font chooser in textformatting. Open another dlg with all known Google Fonts (API call?)
and if possible, your local system fonts???
* Bug note - why is art share upload not showing thumbnail? Maybe push out a stub
url until fully uploaded?
* Possible alertbox filtering?
- Create multiple links that are able to react to alerts
- Filter which alerts will be shown on which links
Expand Down
10 changes: 8 additions & 2 deletions modules/http/upload.pike
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,14 @@ Upload time: %s
string|zero redir = await(G->G->DB->load_config(0, "upload_redirect"))[parts[-1]];
return redir && redirect(redir, 301); //If we don't have a redirect, it's probably deleted, so... 404.
}
mapping file = await(G->G->DB->get_file(fileid, 1));
if (!file) return 0;
//The file might not be uploaded yet. Try a few times to see if we get it.
mapping file;
for (int tries = 0; tries < 10; ++tries) {
file = await(G->G->DB->get_file(fileid, 1));
if (!file) return 0;
if (file->data != "") break;
sleep(1);
}
if (req->request_headers["if-none-match"] == file->metadata->etag) return (["error": 304]);
return ([
"data": file->data,
Expand Down

0 comments on commit b9e0ac3

Please sign in to comment.