🎨 Improve kernel stability https://github.com/siyuan-note/siyuan/issues/9912
This commit is contained in:
parent
8693670d60
commit
b3d51ed94f
1 changed files with 14 additions and 0 deletions
|
@ -21,6 +21,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
@ -168,6 +169,19 @@ func performTx(tx *Transaction) (ret *TxErr) {
|
|||
return
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if e := recover(); nil != e {
|
||||
stack := debug.Stack()
|
||||
msg := fmt.Sprintf("PANIC RECOVERED: %v\n\t%s\n", e, stack)
|
||||
logging.LogErrorf(msg)
|
||||
|
||||
if 0 == tx.state.Load() {
|
||||
tx.rollback()
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
for _, op := range tx.DoOperations {
|
||||
switch op.Action {
|
||||
case "create":
|
||||
|
|
Loading…
Add table
Reference in a new issue