[source] procd: add default timeout for reload trigger actions

LEDE Commits lede-commits at lists.infradead.org
Fri Jul 29 07:41:24 PDT 2016


nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/?p=source.git;a=commitdiff;h=f88e3a4c0abb60bb76a7678dd30dfdc8a808a2f1

commit f88e3a4c0abb60bb76a7678dd30dfdc8a808a2f1
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Fri Jul 29 14:19:17 2016 +0200

    procd: add default timeout for reload trigger actions
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/system/procd/files/procd.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh
index 693a045..fa6f8a9 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -32,6 +32,7 @@
 
 . $IPKG_INSTROOT/usr/share/libubox/jshn.sh
 
+PROCD_RELOAD_DELAY=1000
 _PROCD_SERVICE=
 
 _procd_call() {
@@ -221,6 +222,11 @@ _procd_set_param() {
 	esac
 }
 
+_procd_add_timeout() {
+	[ "$PROCD_RELOAD_DELAY" -gt 0 ] && json_add_int "" "$PROCD_RELOAD_DELAY"
+	return 0
+}
+
 _procd_add_interface_trigger() {
 	json_add_array
 	_procd_add_array_data "$1"
@@ -240,6 +246,8 @@ _procd_add_interface_trigger() {
 
 	json_close_array
 	json_close_array
+
+	_procd_add_timeout
 }
 
 _procd_add_reload_interface_trigger() {
@@ -271,6 +279,8 @@ _procd_add_config_trigger() {
 	json_close_array
 
 	json_close_array
+
+	_procd_add_timeout
 }
 
 _procd_add_raw_trigger() {



More information about the lede-commits mailing list