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

Function list_done

plugins/autoclean.c:541–581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

539}
540
541static struct command_result *list_done(struct command *cmd,
542 const char *method,
543 const char *buf,
544 const jsmntok_t *result,
545 struct per_subsystem *subsystem)
546{
547 const struct subsystem_ops *ops = get_subsystem_ops(subsystem);
548 const jsmntok_t *t, *inv = json_get_member(buf, result, ops->arr_name);
549 size_t i;
550 u64 now = clock_time().ts.tv_sec;
551
552 json_for_each_arr(i, t, inv) {
553 struct per_variant *variant;
554 u64 timestamp;
555 struct out_req *req;
556
557 variant = ops->get_variant(buf, t, subsystem, &timestamp);
558 if (!variant) {
559 continue;
560 }
561
562 /* Continue if we don't care. */
563 if (variant->age == 0) {
564 continue;
565 }
566
567 if (timestamp > now - variant->age) {
568 subsystem->num_uncleaned++;
569 continue;
570 }
571
572 subsystem->cinfo->cleanup_reqs_remaining++;
573 req = jsonrpc_request_start(cmd, ops->del_command,
574 del_done, del_failed, variant);
575 ops->add_del_fields(req, buf, t);
576 send_outreq(req);
577 }
578
579 subsystem->offset += max_entries_per_call;
580 return clean_finished_one(subsystem->cinfo);
581}
582
583static struct command_result *list_failed(struct command *cmd,
584 const char *method,

Callers

nothing calls this directly

Calls 5

get_subsystem_opsFunction · 0.85
json_get_memberFunction · 0.85
clock_timeFunction · 0.85
clean_finished_oneFunction · 0.85
send_outreqFunction · 0.70

Tested by

no test coverage detected