1function set_crons()
2    mcp.register_cron("foo",
3        { every = 2, func = function()
4            foo_run = 1
5        end })
6
7    mcp.register_cron("reload",
8        { every = 3, func = function()
9            if foo_run and once_run then
10                mcp.schedule_config_reload()
11            end
12        end })
13
14    -- will run once per reload.
15    mcp.register_cron("once",
16        { every = 1, rerun = false, func = function()
17            once_run = 1
18        end })
19end
20
21function set_crons2()
22    mcp.register_cron("bar",
23        { every = 2, func = function()
24            bar_run = 1
25        end })
26
27    mcp.register_cron("reload",
28        { every = 3, func = function()
29            -- ensure the old crons didn't also run.
30            if bar_run and not foo_run and once_again and not once_run then
31                mcp.schedule_config_reload()
32            end
33        end })
34
35    -- will run once per reload.
36    mcp.register_cron("onceagain",
37        { every = 3, rerun = false, func = function()
38            once_again = 1
39        end })
40end
41
42function mcp_config_pools()
43    if foo_run == nil then
44        set_crons()
45    else
46        foo_run = nil
47        once_run = nil
48        set_crons2()
49    end
50end
51
52function mcp_config_routes()
53    -- do nothing.
54end
55