Skip to content
Snippets Groups Projects
Commit bae65192 authored by Jan-Philipp Litza's avatar Jan-Philipp Litza Committed by Matthias Schiffer
Browse files

gluon-alfred/gluon-status-page: Query gluon-announced

By not executing all scripts from gluon.announce themselves, both should
be considerably faster and lighter on RAM usage.
parent d2ff7d5c
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk ...@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk
define Package/gluon-alfred define Package/gluon-alfred
SECTION:=gluon SECTION:=gluon
CATEGORY:=Gluon CATEGORY:=Gluon
DEPENDS:=+gluon-core +gluon-announce +gluon-cron +alfred DEPENDS:=+gluon-core +gluon-announced +gluon-neighbour-info +gluon-cron +alfred
TITLE:=Configure alfred TITLE:=Configure alfred
endef endef
......
* * * * * /lib/gluon/announce/collect.lua nodeinfo | gzip | alfred -s 158; /lib/gluon/announce/collect.lua statistics | gzip | alfred -s 159; /lib/gluon/announce/collect.lua neighbours | gzip | alfred -s 160 * * * * * gluon-neighbour-info -d ::1 -p 1001 -t 1 -c 1 -r nodeinfo | gzip | alfred -s 158; gluon-neighbour-info -d ::1 -p 1001 -t 1 -c 1 -r statistics | gzip | alfred -s 159; gluon-neighbour-info -d ::1 -p 1001 -t 1 -c 1 -r neighbours | gzip | alfred -s 160
#!/usr/bin/lua #!/bin/sh
local announce = require 'gluon.announce' echo "Access-Control-Allow-Origin: *"
local json = require 'luci.jsonc'
local util = require 'luci.util'
local nixio = require 'nixio'
local announce_dir = '/lib/gluon/announce/statistics.d/' exec gluon-neighbour-info -s "" -l -d ::1 -p 1001 -t 1 -r statistics
io.write("Access-Control-Allow-Origin: *\n")
io.write("Content-type: text/event-stream\n\n")
while true do
local data = json.stringify(announce.collect_dir(announce_dir))
io.write("data: " .. data .. "\n\n")
io.flush()
nixio.nanosleep(1, 0)
end
#!/usr/bin/lua #!/bin/sh
local announce = require 'gluon.announce' cat <<EOF
local json = require 'luci.jsonc' Access-Control-Allow-Origin: *
local util = require 'luci.util' Content-type: application/json
local nixio = require 'nixio'
local announce_dir = '/lib/gluon/announce/nodeinfo.d/' EOF
exec gluon-neighbour-info -d ::1 -p 1001 -t 1 -c 1 -r nodeinfo
io.write("Access-Control-Allow-Origin: *\n")
io.write("Content-type: application/json\n\n")
local data = json.stringify(announce.collect_dir(announce_dir))
io.write(data)
io.flush()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment