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

Function clean_finished

plugins/autoclean.c:87–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87static struct command_result *clean_finished(struct clean_info *cinfo)
88{
89 for (enum subsystem i = 0; i < NUM_SUBSYSTEM; i++) {
90 if (!cinfo->num_cleaned[i])
91 continue;
92
93 plugin_log(plugin, LOG_DBG, "cleaned %"PRIu64" from %s",
94 cinfo->num_cleaned[i], subsystem_to_str(i));
95 total_cleaned[i] += cinfo->num_cleaned[i];
96 jsonrpc_set_datastore_string(plugin, cinfo->cmd,
97 datastore_path(tmpctx, i, "num"),
98 tal_fmt(tmpctx, "%"PRIu64, total_cleaned[i]),
99 "create-or-replace", NULL, NULL, NULL);
100
101 }
102
103 /* autoclean-once? */
104 if (cinfo->cmd) {
105 struct json_stream *response = jsonrpc_stream_success(cinfo->cmd);
106
107 json_object_start(response, "autoclean");
108 for (enum subsystem i = 0; i < NUM_SUBSYSTEM; i++) {
109 if (cinfo->subsystem_age[i] == 0)
110 continue;
111 json_object_start(response, subsystem_to_str(i));
112 json_add_u64(response, "cleaned", cinfo->num_cleaned[i]);
113 json_add_u64(response, "uncleaned", cinfo->num_uncleaned);
114 json_object_end(response);
115 }
116 json_object_end(response);
117 return command_finished(cinfo->cmd, response);
118 } else { /* timer */
119 plugin_log(plugin, LOG_DBG, "setting next timer");
120 cleantimer = plugin_timer(plugin, time_from_sec(cycle_seconds),
121 do_clean_timer, NULL);
122 return timer_complete(plugin);
123 }
124}
125
126static struct command_result *clean_finished_one(struct clean_info *cinfo)
127{

Callers 5

clean_finished_oneFunction · 0.85
listinvoices_doneFunction · 0.85
listsendpays_doneFunction · 0.85
listforwards_doneFunction · 0.85
do_cleanFunction · 0.85

Calls 11

subsystem_to_strFunction · 0.85
datastore_pathFunction · 0.85
time_from_secFunction · 0.85
timer_completeFunction · 0.85
plugin_logFunction · 0.70
jsonrpc_stream_successFunction · 0.70
command_finishedFunction · 0.70
plugin_timerClass · 0.70
json_object_startFunction · 0.50
json_add_u64Function · 0.50
json_object_endFunction · 0.50

Tested by

no test coverage detected