bee icon indicating copy to clipboard operation
bee copied to clipboard

Don't hang request during pinning creation

Open tmm360 opened this issue 3 years ago • 4 comments

Summary

Currently the operation to create a new pin imply an hanging request that can take very long time. An async operation, permitting to request the pinning status that contain also the sync percentage, should be preferable.

Motivation

To keep hanged requests during long operations is a bad practice. In case of large files this can keep very long time, and is very easy that will lead to client timeouts. Moreover, this keep busy the client waiting for response.

Implementation

Every time that a pin request is submitted, an async task is started for complete the data retrieval. In the meantime, the response is immediately replied to the client, that in this way doesn't need to keep waiting.

Client will be able to request info on how pinning operation is going. The pin details request will return if pinning is present, if it is completed, or if it is in sync. In this case, response could also include information on operation progress.

Drawbacks

Don't see anything.

tmm360 avatar Aug 23 '22 01:08 tmm360

This would be indeed nicer. Please note that this is a general problem with any API endpoint that deals with big data, ergo it takes long time.

It takes long time because currently Bee fetches all the content first in order to have the data locally in order to be able to pin it. As a workaround I would suggest to use the swarm-pin header when uploading if that is possible in your use case, because then the uploaded content could be automatically pinned and you

agazso avatar Aug 23 '22 12:08 agazso

Yes, thanks @agazso, I know and I will use primary the swarm-pin header in our application. Anyway, this is a thing to have, in my opinion.

tmm360 avatar Aug 23 '22 12:08 tmm360

We are not planning to have this feature in the near future. We can reopen it if further discussion is needed at any point in the future.

istae avatar May 24 '23 11:05 istae

Please @istae reopen this and leave it open. Call must be async, if not now, at least in future. To close this is a bad decision, in my opinion.

tmm360 avatar May 24 '23 11:05 tmm360