ipfs-webui icon indicating copy to clipboard operation
ipfs-webui copied to clipboard

Files: track pins in progress across node restarts

Open lidel opened this issue 4 years ago • 0 comments

Right now we do pin.remote.add with background:true.

It's fine for smaller files which get pinned pretty fast, but not really honest when it comes to bigger files.

We should (rough draft)

  • track pin status
    • this should not be blocking, keep background:false
    • store pins "in progress" in local storage as {service}:{cid}
      • this way we persist them across browsing sessions / laptop restarts etc
    • periodically check this storage and poll for status and update UI to reflect changes
      • avoid spamming remote service
        • interval should be based on time since pin event.
        • after each passing 30s we should increase interval and back-off to something more sensible (eg. 10s → 30s →1m → 5m → 15m)
  • mark remote pin as "in progress" and indicate that in UI (could be "breathing" effect or something)
    • if "ongoing" pin fails we should
      • mark it as "failed" and indicate that in UI (icon tinted in red?)
      • clicking on failed cloud pin should
        • clear the 'failed' indicator
        • open pin modal with failed item unchecked
          • in the modal we could indicate which service failed with some icon, if possible, but after closing the modal that indicator goes away (one time thing)
  • we should store "ongoing" pins in localStorage, so even when app is closes and opened later, we keep track of pins initiated from the webui
  • when app starts it should restore any "ongoing" pins
    • read service:cid pairings from local storage
    • check states from each service via pin remote ls --service {service} --cid {cid1},{cid2} --status=queued,pinning,pinned,failed (where "cid1" and "cid2" are ongoing pins on "service")
    • update UI to reflect state
      • if pinned, remove from local storage
      • if queued/pinning, show the "ongoing" status and keep polling until its "pinned" or "failed"
      • if failed, mark it with the same 'failed' indicator

We should do the same tracking for local pins:

  • node could be stopped before pinning finishes, so we need store them and resume any stale ones on startup
  • removing "ongoing local pin" flag could be done at the end of local pin operation or via periodic check if pin exists
  • there should be a broom (tm) that allows user to clean up entries for finished pin jobs

lidel avatar Apr 01 '21 15:04 lidel