| 801 | } |
| 802 | |
| 803 | static const char *init(struct command *init_cmd, |
| 804 | const char *buf UNUSED, const jsmntok_t *config UNUSED) |
| 805 | { |
| 806 | struct subsystem_and_variant sv; |
| 807 | plugin = init_cmd->plugin; |
| 808 | |
| 809 | /* Plugin owns global */ |
| 810 | tal_steal(plugin, timer_cinfo); |
| 811 | plugin_set_memleak_handler(plugin, memleak_mark_timer_cinfo); |
| 812 | |
| 813 | cleantimer = global_timer(plugin, time_from_sec(cycle_seconds), do_clean_timer, NULL); |
| 814 | |
| 815 | /* We don't care if this fails (it usually does, since entries |
| 816 | * don't exist! */ |
| 817 | sv = first_sv(); |
| 818 | do { |
| 819 | rpc_scan_datastore_str(tmpctx, init_cmd, |
| 820 | datastore_path(tmpctx, &sv, "num"), |
| 821 | JSON_SCAN(json_to_u64, total_cleaned(&sv))); |
| 822 | } while (next_sv(&sv)); |
| 823 | |
| 824 | /* Optimization FTW! */ |
| 825 | rpc_enable_batching(plugin); |
| 826 | return NULL; |
| 827 | } |
| 828 | |
| 829 | static char *cycle_seconds_option(struct command *cmd, const char *arg, |
| 830 | bool check_only, |
nothing calls this directly
no test coverage detected