bookkeeper: no longer read listchannelmoves 1000 entries at a time.
This reverts `bookkeeper: only read listchannelmoves 1000 entries at a time.` commit, so we can properly fix the scalability in the coming patches. tests/test_coinmoves.py::test_generate_coinmoves (100,000): Time (from start to end of l2 node): 207 seconds Worst latency: 106 seconds Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -55,10 +55,6 @@ static struct refresh_info *use_rinfo(struct refresh_info *rinfo)
|
||||
return rinfo;
|
||||
}
|
||||
|
||||
/* Recursion */
|
||||
static struct command_result *limited_listchannelmoves(struct command *cmd,
|
||||
struct refresh_info *rinfo);
|
||||
|
||||
static struct command_result *rinfo_one_done(struct command *cmd,
|
||||
struct refresh_info *rinfo)
|
||||
{
|
||||
@@ -138,36 +134,16 @@ static struct command_result *listchannelmoves_done(struct command *cmd,
|
||||
"create-or-replace",
|
||||
datastore_done, NULL, use_rinfo(rinfo));
|
||||
|
||||
/* If there might be more, try asking for more */
|
||||
if (moves->size != 0)
|
||||
limited_listchannelmoves(cmd, rinfo);
|
||||
|
||||
return rinfo_one_done(cmd, rinfo);
|
||||
}
|
||||
|
||||
/* We do 1000 at a time to avoid overwhelming lightningd */
|
||||
static struct command_result *limited_listchannelmoves(struct command *cmd,
|
||||
struct refresh_info *rinfo)
|
||||
{
|
||||
struct bkpr *bkpr = bkpr_of(cmd->plugin);
|
||||
struct out_req *req;
|
||||
|
||||
req = jsonrpc_request_start(cmd, "listchannelmoves",
|
||||
listchannelmoves_done,
|
||||
plugin_broken_cb,
|
||||
use_rinfo(rinfo));
|
||||
json_add_string(req->js, "index", "created");
|
||||
json_add_u64(req->js, "start", bkpr->channelmoves_index + 1);
|
||||
json_add_u64(req->js, "limit", 1000);
|
||||
return send_outreq(req);
|
||||
}
|
||||
|
||||
static struct command_result *listchainmoves_done(struct command *cmd,
|
||||
const char *method,
|
||||
const char *buf,
|
||||
const jsmntok_t *result,
|
||||
struct refresh_info *rinfo)
|
||||
{
|
||||
struct out_req *req;
|
||||
const jsmntok_t *moves, *t;
|
||||
size_t i;
|
||||
struct bkpr *bkpr = bkpr_of(cmd->plugin);
|
||||
@@ -183,7 +159,13 @@ static struct command_result *listchainmoves_done(struct command *cmd,
|
||||
"create-or-replace",
|
||||
datastore_done, NULL, use_rinfo(rinfo));
|
||||
|
||||
limited_listchannelmoves(cmd, rinfo);
|
||||
req = jsonrpc_request_start(cmd, "listchannelmoves",
|
||||
listchannelmoves_done,
|
||||
plugin_broken_cb,
|
||||
use_rinfo(rinfo));
|
||||
json_add_string(req->js, "index", "created");
|
||||
json_add_u64(req->js, "start", bkpr->channelmoves_index + 1);
|
||||
send_outreq(req);
|
||||
return rinfo_one_done(cmd, rinfo);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user