mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-18 13:14:56 +01:00
Small LN refactoring and retrying SQL requests on failures...
This commit is contained in:
@@ -3,17 +3,27 @@
|
||||
. ./trace.sh
|
||||
|
||||
sql() {
|
||||
trace "sqlite3 -cmd \".timeout 25000\" ${DB_FILE} \"${1}\""
|
||||
sqlite3 -cmd ".timeout 25000" ${DB_FILE} "${1}"
|
||||
# sqlite3 ${DB_FILE} "PRAGMA busy_timeout=20000; ${1}"
|
||||
trace "sqlite3 -cmd \".timeout 40000\" ${DB_FILE} \"${1}\""
|
||||
sqlite3 -cmd ".timeout 40000" ${DB_FILE} "${1}"
|
||||
|
||||
return $?
|
||||
if [ "$?" -ne 0 ]; then
|
||||
# SQL didn't work, let's retry to be sure...
|
||||
trace "SQL didn't work, let's retry..."
|
||||
sqlite3 -cmd ".timeout 40000" ${DB_FILE} "${1}"
|
||||
fi
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
sql_rawtx() {
|
||||
trace "sqlite3 -cmd \".timeout 25000\" ${DB_FILE}_rawtx \"${1}\""
|
||||
sqlite3 -cmd ".timeout 25000" ${DB_FILE}_rawtx "${1}"
|
||||
# sqlite3 ${DB_FILE} "PRAGMA busy_timeout=20000; ${1}"
|
||||
trace "sqlite3 -cmd \".timeout 40000\" ${DB_FILE}_rawtx \"${1}\""
|
||||
sqlite3 -cmd ".timeout 40000" ${DB_FILE}_rawtx "${1}"
|
||||
|
||||
return $?
|
||||
if [ "$?" -ne 0 ]; then
|
||||
# SQL didn't work, let's retry to be sure...
|
||||
trace "SQL didn't work, let's retry..."
|
||||
sqlite3 -cmd ".timeout 40000" ${DB_FILE}_rawtx "${1}"
|
||||
fi
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user