bbfdm: delay start datamodel services

datamodel services moved down in startup sequence to avoid race conditions
This commit is contained in:
Vivek Kumar Dutta 2024-09-10 18:54:48 +05:30
parent 6a34e2da97
commit 3ec6b54d46
3 changed files with 11 additions and 9 deletions

View file

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=bbfdm PKG_NAME:=bbfdm
PKG_VERSION:=1.12.0 PKG_VERSION:=1.12.1
USE_LOCAL:=0 USE_LOCAL:=0
ifneq ($(USE_LOCAL),1) ifneq ($(USE_LOCAL),1)
@ -53,7 +53,7 @@ define Package/dm-service
CATEGORY:=Utilities CATEGORY:=Utilities
SUBMENU:=TRx69 SUBMENU:=TRx69
TITLE:=Datamodel ubus backend to expose micro-service tree TITLE:=Datamodel ubus backend to expose micro-service tree
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +libbbfdm-ubus +jq +bbf_configmngr DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +libbbfdm-ubus +bbf_configmngr
endef endef
define Package/bbf_configmngr define Package/bbf_configmngr

View file

@ -1,6 +1,6 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
START=40 START=85
STOP=8 STOP=8
USE_PROCD=1 USE_PROCD=1
@ -33,13 +33,17 @@ _add_microservice()
name="$(basename ${path})" name="$(basename ${path})"
name="${name//.json}" name="${name//.json}"
enable="$(jq -r '.daemon.enable//1' ${path})" json_load_file "${path}"
json_select daemon
json_get_var enable enable 1
if [ "${enable}" -eq "0" ]; then if [ "${enable}" -eq "0" ]; then
log "datamodel micro-service ${name} not enabled" log "datamodel micro-service ${name} not enabled"
return 0 return 0
fi fi
loglevel="$(jq -r '.daemon.config.loglevel//3' ${path})" json_select config
json_get_var loglevel loglevel 3
procd_open_instance "${name}" procd_open_instance "${name}"
@ -59,7 +63,7 @@ _add_microservice()
configure_bbfdm_micro_services() configure_bbfdm_micro_services()
{ {
local enable enable_core enable_respawn local enable enable_core
config_load bbfdm config_load bbfdm
validate_bbfdm_micro_service_section || { validate_bbfdm_micro_service_section || {

View file

@ -1,6 +1,6 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
START=65 START=90
STOP=10 STOP=10
USE_PROCD=1 USE_PROCD=1
@ -44,8 +44,6 @@ configure_bbfdmd()
start_service() start_service()
{ {
mkdir -p ${BBFDM_TEMP_DIR}
procd_open_instance "bbfdm" procd_open_instance "bbfdm"
configure_bbfdmd configure_bbfdmd
procd_set_param respawn procd_set_param respawn