Commit graph

29 commits

Author SHA1 Message Date
infinite-persistence
91d0eb30b8
tus: remove multi-tab assumption + pass original err msg
Completely remove any assumptions of multi-tab uploading from server status (should have done it previously, but wanted to be conservative). This should make it less confusing to the user.

The real issue still remains -- the upload is somehow locked at the backend.

Also, when we override the error to present a user-friendly message to the user, pass the original error to the log (just in case it gives extra info).
2022-01-13 09:57:45 +08:00
infinite-persistence
238f6b2eda
tus: adjust retry delay + remove logging
From the logs, it seems like the second retry (5s) fixes the "normal" cases, so just remove the first retry (0s).

Also from the logs, if a retry doesn't work by the third attempt (10s), it's most likely the "locked" case and retrying further doesn't help. So, reduce one more useless retry attemp.

Removed logging since we've gathered enough data, and that this hook is expected to be hit a lot, so we don't want to clog the logs.
2022-01-13 09:43:29 +08:00
infinite-persistence
c90c5bcc2a
Route markdown to v1 (#680)
I think I just forgot to do it the first time.
2022-01-12 10:31:46 -05:00
infinite-persistence
6bd384b01a
TUS: retry on 423_locked to try address "failed to upload chunk"
## Background
Per developer of `tus-js-client`, it is normal to occasionally encounter upload errors. The auto-retry mechanism is meant to address this.

While implementing tab-lock to prevent multiple uploads of the same file, 423_locked was used to detect this scenario. But 423_locked could also mean "the server is busy writing the chunk" (per discussion with Randy), so we kind of disabled the auto-retry mechanism accidentally.

Meanwhile, from a prior discussion with Randy, one of the chunk-writing duration took 3 minutes. Our current maximum of "retry after 15s" wouldn't help.

## Change
1. Given that tab-locking was improved recently and no longer reliant on the server error messages (we use secure storage to mark a file as locked), reverted the change to "skip retry on 409/423". This is now back to normal recommended behavior.
2. `tus-js-client` currently does not support variable retry delay, otherwise we could prolong the delay if the error was 423. Since we know it could take up to 3 minutes, and that we don't know if it's file-size dependant, just add another 30s retry and put a friendlier message asking the user to retry themselves after waiting a bit.
2022-01-10 16:46:57 +08:00
infinite-persistence
46c7c193be
Log the status code for the retry 2022-01-10 11:50:29 +08:00
infinite-persistence
47043bc965
Remove 'retryTimeout' - that's just the timer ID, nothing useful 2022-01-10 11:39:34 +08:00
infinite-persistence
01459d906a
tus: Get more information from publish errors 2022-01-06 15:39:51 +08:00
infinite-persistence
555bde87f8
tus: make chunk size multiples of 256KiB
Our current chunk size is 25,000,000.

Google and S3 documentation suggests the chunk size to be multiples of 256KiB. MongoDB too.  We aren't using any of those, but I guess no harm doing the same.  From the logs, the values "25,000,000" and "50,000,000" seems to be common.
2022-01-06 15:39:51 +08:00
infinite-persistence
9c723b3db3
tus: skip fingerprint storage
## Ticket
418 TUS: skip fingerprint storage

- Fingerprints for canceled uploads are not being cleared by tus-js-client. It's in localStorage, and there is limit for that.
- We are storing the confirmed fingerprint (from the backend) in redux anyway, so we don't need that functionality.
2021-12-13 15:35:21 +08:00
infinite-persistence
157b50c58e
Upload: tab sync and various fixes (#428)
* Upload: fix redux key clash

## Issue
`params` is the "final" value that will be passed to the SDK and  `channel` is not a valid argument (it should be `channel_name`). Also, it seems like we only pass the channel ID now and skip the channel name entirely.

For the anonymous case, a clash will still happen when since the channel part is hardcoded to `anonymous`.

## Approach
Generate a guid in `params` and use that as the key to handle all the cases above. We couldn't use the `uploadUrl` because v1 doesn't have it.

The old formula is retained to allow users to retry or cancel their existing uploads one last time (otherwise it will persist forever). The next upload will be using the new key.

* Upload: add tab-locking

## Issue
- The previous code does detect uploads from multiple tabs, but it was done by handling the CONFLICT error message from the backend. At certain corner-cases, this does not work well. A better way is to not allow resumption while the same file is being uploading from another tab.

- When an upload from 1 tab finishes, the GUI on the other tab does not remove the completed item. User either have to refresh or click Cancel. Clicking Cancel results in the 404 backend error. This should be avoided.

## Approach
- Added tab synchronization and locking by passing the "locked" and "removed" information through `localStorage`.

## Other considered approaches
- Wallet sync -- but decided not to pollute the wallet.
- 3rd-party redux tab syncing -- but decided it's not worth adding another module for 1 usage.

* Upload: check if locked before confirming delete

## Reproduce
Have 2 tabs + paused upload
Open "cancel" dialog in one of the tabs.
Continue upload in other tab
Confirm cancellation in first tab
Upload disappears from both tabs, but based on network traffic the upload keeps happening.
(If upload finishes the claim seems to get created)
2021-12-07 09:48:09 -05:00
infinite-persistence
eb83a834a1
TUS: handle remaining locked file error messages 2021-11-23 11:28:32 +08:00
infinite-persistence
2d3057d5cf
Detect concurrent uploads and stop it. 2021-11-22 16:12:11 +08:00
infinite-persistence
b6e9c7aabf
TUS: handle URL removal on 4xx errors
## Issue
The TUS client automatically removes the upload fingerprint whenever there is a 4xx error. When we try to resume later, we couldn't find the the fingerprint and ended up creating a new upload ID.

## Changes
Since we are also storing the uploadUrl ourselves, provided that to override the tus client's default behavior of restarting a new session on 4xx errors.
2021-11-22 16:12:10 +08:00
infinite-persistence
d48a7c7295
TUS: reduce chunk size from 100MB to 25MB.
The stalling behavior has changed a bit, probably with the removal of CF.

The stall difference between 10MB and 50MB is not too noticable, so picking 25MB as a start.
2021-11-19 14:40:03 +08:00
infinite-persistence
b0509bc990
Band-aid: wait a while before sending notify
## Issue
The status = 0 is due to unresponsive backend right after the tus-upload. No root-cause found yet.

## Change
It may or may not help, but adding a delay to account for the unresponsive stage for now.
2021-11-12 18:43:57 +08:00
infinite-persistence
d8080a9fda
Notify: log retry attempts 2021-11-12 16:30:41 +08:00
infinite-persistence
62e7fe06a5
TUS: Don't retry on 4xx
## Issue/Steps
From Randy:
- started the upload then open a new tab of the same page
- one of the tab finished the upload and successfully published the file, and the other tab received 404 error on patch and head request, because the file is already removed on the server

## Changes
Use the default onRetry code that ignores all 4xx, except for LOCKED and CONFLICT. Had to duplicate some code from tus because I still need to inject the 'retry' progress for the GUI to update the string.
2021-11-12 14:32:41 +08:00
infinite-persistence
dfe30b6d78
TUS: fix parallel uploads of the same file
## Issue
If you make 2 claims from the same source file, the second upload thinks it's trying to resume from the first one. They should be unique uploads.

## Approach
Stash the upload url for comparison when looking up existing uploads to resume.

Stash that in `params` to minimize code changes. We'll just need to ensure it is cleared before we generate the SDK payload.
2021-11-12 14:32:40 +08:00
infinite-persistence
861aaf4cde Notify: Re-enable delay but only for initial connection problem
We want to avoid the double `notify`, and also to confirm whether the SDK is timing out.
2021-11-12 11:19:26 +08:00
infinite-persistence
9bfa1a3577
Notify: Disable retry + try to report status code 2021-11-12 09:01:36 +08:00
infinite-persistence
7ef5975ee8
Notify: auto-retry once after 10 seconds
Also:
- Show the resume button on notify errors.
- Changed the error message to differentiate against v1's.
2021-11-11 09:55:48 +08:00
infinite-persistence
b5f1ae1291
Tus-retry: widen delay gap + add 1 more retry 2021-11-11 09:54:25 +08:00
infinite-persistence
cb6a044584
Support resume-able upload via tus (#186)
* Publish button: use spinner instead of "Publishing..."

Looks better, plus the preview could take a while sometimes.

* Refactor `doPublish`. No functional change

This is to allow `doPublish` to accept a custom payload as an input (for resuming uploads), instead of always resolving it from the redux data.

* Add doPublishResume

* Support resume-able upload via tus

## Issue
38 Handle resumable file upload

## Notes
Since we can't serialize a File object, we'll need to the user to re-select the file to resume.

* Exclude "modified date" for Firefox/Android

## Issue
It appears that the modification date of the Android file changes when selected, so that file was deemed "different" when trying to resume upload.

## Change
Exclude modification date for now. Let's assume a smart user.

* Move 'currentUploads' to 'publish' reducer

`publish` is currently rehydrated, so we can ride on that and don't need to store the `currentUploads` in `localStorage` for persistence. This would allow us to store Markdown Post data too, as `localStorage` has a 5MB limit per app.

We could have also made `webReducer` rehydrate, but in this repo, there is no need to split it to another reducer. It also makes more sense to be part of publish anyway (at least to me).

This change is mostly moving items between files, with the exception of
1. An additional REHYDRATE in the publish reducer to clean up the tusUploader.
2. Not clearing `currentUploads` in CLEAR_PUBLISH.

* Restore v1 code for livestream replay, etc.

v2 (tus) does not handle `remote_url`, so the app still needs v1 for that. Since we'll still have v1 code, use v1 for previews as well.
2021-11-10 13:16:16 -05:00
Andrey Beletsky
8e3aee5813 Change API server address to odysee-api 2021-07-20 10:23:00 -04:00
jessopb
989126c603
Feat publish replays on master (#5863)
* provide livestream replay publish via url
2021-04-14 00:06:11 -04:00
zeppi
713109167c publish, edit, remote_url publish 2021-03-26 18:43:09 -04:00
Sean Yesmunt
7c3ff32496
Add retry message to publish error 2021-01-08 16:38:01 -05:00
infiinte-persistence
985aada5e4 Fix preview delay on Web by sending a dummy file. 2020-10-02 10:25:17 -04:00
jessop
e3c2919373 rename lbrytv to web
language and API consts

improve customization
custom homepages
get config from .env.default
custom title and logo

small changes

add pinned item to sidebar

rebase?
2020-05-25 17:21:02 -04:00