Skip to content

long-running processes could emit "progress" events #667

@pinheadmz

Description

@pinheadmz

Some RPC calls like wallet rescan return success: true right away even though from a UX perspective, the rescan has just begun:

hsd/lib/wallet/http.js

Lines 189 to 201 in eea15c2

this.post('/rescan', async (req, res) => {
if (!req.admin) {
res.json(403);
return;
}
const valid = Validator.fromRequest(req);
const height = valid.u32('height');
res.json(200, { success: true });
await this.wdb.rescan(height);
});

Other RPC calls like the WIP dumpzone or pruneblockchain may timeout long before completion since the http timeout is only 5 seconds (from brq).

I was thinking we could establish a convention where these calls always return some kind of "in progress" message once initiated so they don't time out, and then the process itself can emit "progress" events that can either be listened to by the caller (i.e. bob wallet UI) or even from the command line similar to hsw-cli listen

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions