Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Web] Research for long running actions (~ Web Worker) #10855

Closed
tbsbdr opened this issue Apr 29, 2024 · 2 comments
Closed

[Web] Research for long running actions (~ Web Worker) #10855

tbsbdr opened this issue Apr 29, 2024 · 2 comments
Assignees

Comments

@tbsbdr
Copy link
Contributor

tbsbdr commented Apr 29, 2024

research ticket for: #7039

@tbsbdr tbsbdr changed the title [Web] Research for Web Worker [Web] Research for long running actions (~ Web Worker) Apr 29, 2024
@JammingBen JammingBen self-assigned this May 15, 2024
@JammingBen
Copy link
Collaborator

JammingBen commented May 16, 2024

See the proof of concept and all related information here: #10916

It feels pretty stable to me, however, I'd recommend to start using it in small incrementions. First we should think about where exactly we want to use this functionality. Looking at #7039, the following 4 are probably good candidates:

  • copy
  • move
  • delete
  • restore

Then there are 2 more scenarios to think of: uploading and token refresh.

Uploading is not necessary IMO. Yes, it happens in the main thread, but it's already a non-blocking async operation and the user can navigate freely within the application. Also, I don't think we can simply introduce web workers in Uppy.

Token refresh is a bit more complicated. I'm gonna start with saying that I have absolutely no idea if and how we could introduce web workers here, especially since a big chunk of the functionality is located in the oidc lib we're using (btw this is a known issue: authts/oidc-client-ts#954). I'd handle this topic completely separate to be honest, starting with optimizing our token refresh process. It currently re-loads hundreds of assets which results in an error when the network connection is slow. Maybe something similar happens when the browser tab is being throttled? Then we could try doing the token renewal earlier than 10 seconds before expiry, at least if the the token lifespan is > 5 minutes.

@JammingBen
Copy link
Collaborator

Update to this statement:

Token refresh is a bit more complicated. I'm gonna start with saying that I have absolutely no idea if and how we could introduce web workers here, especially since a big chunk of the functionality is located in the oidc lib we're using (btw this is a known issue: authts/oidc-client-ts#954). I'd handle this topic completely separate to be honest, starting with optimizing our token refresh process. It currently re-loads hundreds of assets which results in an error when the network connection is slow. Maybe something similar happens when the browser tab is being throttled? Then we could try doing the token renewal earlier than 10 seconds before expiry, at least if the the token lifespan is > 5 minutes.

@kulmann and I did a brainstorming yesterday and found a promising approach. The idea is to just put the timer in a worker, but keep the actual token renewal in the main thread. I'm currently implementing this approach.

For the other operations (copy, move, retry) I'm going to create separate stories so we can tackle them in the next sprint(s).

Since the research part is done and documented here (and in #10916), I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants