MCPcopy Create free account
hub / github.com/ElementsProject/lightning / do_clean

Function do_clean

plugins/autoclean.c:595–641  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

593}
594
595static struct command_result *do_clean(struct clean_info *cinfo)
596{
597 cinfo->cleanup_reqs_remaining = 0;
598 cinfo->reqs_start = time_mono();
599
600 for (size_t i = 0; i < NUM_SUBSYSTEM_TYPES; i++) {
601 struct per_subsystem *ps = &cinfo->per_subsystem[i];
602 struct out_req *req;
603 bool have_variant = false;
604 const char *filter;
605 const struct subsystem_ops *ops = get_subsystem_ops(ps);
606
607 for (size_t j = 0; j < NUM_SUBSYSTEM_VARIANTS; j++) {
608 if (ps->variants[j].age)
609 have_variant = true;
610 }
611
612 /* Don't bother listing if we don't care. */
613 if (!have_variant)
614 continue;
615
616 /* Don't bother if we're past the end already. */
617 if (ps->offset >= ps->max)
618 continue;
619
620 filter = tal_fmt(tmpctx, "{\"%s\":[{%s}]}",
621 ops->arr_name, ops->list_filter);
622 req = jsonrpc_request_with_filter_start(cinfo->cmd,
623 tal_fmt(tmpctx,
624 "list%s",
625 ops->system_name),
626 filter,
627 list_done, list_failed,
628 ps);
629 /* Don't overwhelm lightningd or us if there are millions of
630 * entries! */
631 json_add_string(req->js, "index", "created");
632 json_add_u64(req->js, "start", ps->offset);
633 json_add_u64(req->js, "limit", max_entries_per_call);
634 send_outreq(req);
635 cinfo->cleanup_reqs_remaining++;
636 }
637
638 if (cinfo->cleanup_reqs_remaining)
639 return command_still_pending(cinfo->cmd);
640 return clean_finished(cinfo);
641}
642
643static struct command_result *wait_done(struct command *cmd,
644 const char *method,

Callers 2

do_clean_after_sleepFunction · 0.85
wait_doneFunction · 0.85

Calls 7

time_monoFunction · 0.85
get_subsystem_opsFunction · 0.85
json_add_u64Function · 0.85
clean_finishedFunction · 0.85
send_outreqFunction · 0.70
command_still_pendingFunction · 0.70
json_add_stringFunction · 0.50

Tested by

no test coverage detected