Skip to content

Commit

Permalink
add connect and rpc timeout in start
Browse files Browse the repository at this point in the history
  • Loading branch information
lsy3993 committed May 29, 2024
1 parent 116598d commit 834f08a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
4 changes: 2 additions & 2 deletions doc/start_syncer.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ bash bin/start_syncer.sh --commit_txn_timeout 33s
### --connect_timeout duration
用于指定连接超时时间
```bash
bash bin/start_syncer.sh --connect_timeout_syncer 1s
bash bin/start_syncer.sh --connect_timeout 10s
```
默认值为1s

Expand All @@ -106,6 +106,6 @@ bash bin/start_syncer.sh --local_repo_name "repo_name"
### --rpc_timeout duration
用于指定rpc超时时间
```bash
bash bin/start_syncer.sh --rpc_timeout_duration 3s
bash bin/start_syncer.sh --rpc_timeout 30s
```
默认值为3s
18 changes: 17 additions & 1 deletion shell/start_syncer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ usage() {
echo "
Usage: $0 [--daemon] [--log_level [info|debug|trace]] [--log_dir dir] [--db_dir dir]
[--host host] [--port port] [--pid_dir dir] [--pprof [true|false]]
[--pprof_port p_port]
[--pprof_port p_port] [--connect_timeout s] [--rpc_timeout s]
"
exit 1
}
Expand All @@ -41,6 +41,8 @@ OPTS="$(getopt \
-l 'pid_dir:' \
-l 'pprof:' \
-l 'pprof_port:' \
-l 'connect_timeout:' \
-l 'rpc_timeout:' \
-- "$@")"

eval set -- "${OPTS}"
Expand All @@ -57,6 +59,8 @@ DB_USER=""
DB_PASSWORD=""
PPROF="false"
PPROF_PORT="6060"
CONNECT_TIMEOUT="10s"
RPC_TIMEOUT="30s"
while true; do
case "$1" in
-h)
Expand Down Expand Up @@ -121,6 +125,14 @@ while true; do
PPROF_PORT=$2
shift 2
;;
--connect_timeout)
CONNECT_TIMEOUT=$2
shift 2
;;
--rpc_timeout)
RPC_TIMEOUT=$2
shift 2
;;
--)
shift
break
Expand Down Expand Up @@ -179,6 +191,8 @@ if [[ "${RUN_DAEMON}" -eq 1 ]]; then
"-pprof_port=${PPROF_PORT}" \
"-log_level=${LOG_LEVEL}" \
"-log_filename=${LOG_DIR}" \
"-connect_timeout=${CONNECT_TIMEOUT}" \
"-rpc_timeout=${RPC_TIMEOUT}" \
"$@" >>"${LOG_DIR}" 2>&1 </dev/null &
echo $! > ${pidfile}
else
Expand All @@ -193,5 +207,7 @@ else
"-port=${PORT}" \
"-pprof=${PPROF}" \
"-pprof_port=${PPROF_PORT}" \
"-connect_timeout=${CONNECT_TIMEOUT}" \
"-rpc_timeout=${RPC_TIMEOUT}" \
"-log_level=${LOG_LEVEL}" | tee -a "${LOG_DIR}"
fi

0 comments on commit 834f08a

Please sign in to comment.