Skip to content

Retry on stale/stuck upload #2049

@Rychu-Pawel

Description

@Rychu-Pawel

What would you like to discuss?

My use case is to upload a large file to the server. I would like to force a retry when the upload gets stuck.

I don't see any relevant timeout to be set in the library so I created a setInterval() logic that checks how long it has been since the last progress change. I also made a uploadProgress handler that reset the time variable that is used by the setInterval's logic.
Now I'm wondering what's the best way to force the retry when there has not been any progress for X seconds?

My first idea was to cancel the request and add the beforeError hook that will check if the promise was canceled and if so then throw a RetryError to force the retry but I guess that won't work as the promise is already set to canceled state, right?

Have you considered adding an uploadTimeout to the library that will check has there been any progress for the last X milliseconds and timeout if not?

Checklist

  • I have read the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions