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

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

Open
pinheadmz opened this issue Dec 8, 2021 · 0 comments
Open

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

pinheadmz opened this issue Dec 8, 2021 · 0 comments

Comments

@pinheadmz
Copy link
Member

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

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

No branches or pull requests

1 participant