diff --git a/kernel/api/transaction.go b/kernel/api/transaction.go index 387110ef0..98e0b3151 100644 --- a/kernel/api/transaction.go +++ b/kernel/api/transaction.go @@ -49,6 +49,13 @@ func performTransactions(c *gin.Context) { return } + if !util.IsBooted() { + ret.Code = -1 + ret.Msg = fmt.Sprintf(model.Conf.Language(74), int(util.GetBootProgress())) + ret.Data = map[string]interface{}{"closeTimeout": 5000} + return + } + var transactions []*model.Transaction if err = gulu.JSON.UnmarshalJSON(data, &transactions); nil != err { ret.Code = -1 @@ -70,12 +77,6 @@ func performTransactions(c *gin.Context) { ret.Code = 1 return } - if model.ErrNotFullyBoot == err { - ret.Code = -1 - ret.Msg = fmt.Sprintf(model.Conf.Language(74), int(util.GetBootProgress())) - ret.Data = map[string]interface{}{"closeTimeout": 5000} - return - } if nil != err { tx, txErr := sql.BeginTx() if nil != txErr { diff --git a/kernel/go.mod b/kernel/go.mod index 8c0817785..a0b426a46 100644 --- a/kernel/go.mod +++ b/kernel/go.mod @@ -29,7 +29,7 @@ require ( github.com/gin-contrib/gzip v0.0.6 github.com/gin-contrib/sessions v0.0.5 github.com/gin-gonic/gin v1.8.1 - github.com/imroc/req/v3 v3.20.1 + github.com/imroc/req/v3 v3.21.0 github.com/jinzhu/copier v0.3.5 github.com/mattn/go-sqlite3 v2.0.3+incompatible github.com/mitchellh/go-ps v1.0.0 @@ -38,11 +38,11 @@ require ( github.com/patrickmn/go-cache v2.1.0+incompatible github.com/qiniu/go-sdk/v7 v7.13.0 github.com/radovskyb/watcher v1.0.7 - github.com/siyuan-note/dejavu v0.0.0-20220826133259-d2e361789965 + github.com/siyuan-note/dejavu v0.0.0-20220827102004-e48207424bf0 github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f github.com/siyuan-note/filelock v0.0.0-20220720144616-011221f7e128 - github.com/siyuan-note/httpclient v0.0.0-20220826133000-34b9da3530d9 + github.com/siyuan-note/httpclient v0.0.0-20220827101805-6352f741c2f1 github.com/siyuan-note/logging v0.0.0-20220717040626-f796b05ee520 github.com/steambap/captcha v1.4.1 github.com/vmihailenco/msgpack/v5 v5.3.5 @@ -111,9 +111,9 @@ require ( github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.8.0 // indirect - golang.org/x/crypto v0.0.0-20220824171710-5757bc0c5503 // indirect + golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d // indirect golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect - golang.org/x/net v0.0.0-20220822230855-b0a4917ee28c // indirect + golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b // indirect golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde // indirect golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 // indirect golang.org/x/tools v0.1.12 // indirect diff --git a/kernel/go.sum b/kernel/go.sum index 5d4988a7a..4548b2f2d 100644 --- a/kernel/go.sum +++ b/kernel/go.sum @@ -200,8 +200,8 @@ github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= -github.com/imroc/req/v3 v3.20.1 h1:kaQ6oMW6OGrLHVDpVlMv9WZV4wZVbR6Aq5TVfI8bZ3U= -github.com/imroc/req/v3 v3.20.1/go.mod h1:EluRnkfh8A39BmrCARYhcUrfGyR8qPw+O0BZyTy4j9k= +github.com/imroc/req/v3 v3.21.0 h1:RN9OEenGt8iVNxNV7z9Dtj/SkxETGtqqkOND2Wti6gw= +github.com/imroc/req/v3 v3.21.0/go.mod h1:EluRnkfh8A39BmrCARYhcUrfGyR8qPw+O0BZyTy4j9k= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= @@ -349,16 +349,16 @@ github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1l github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= -github.com/siyuan-note/dejavu v0.0.0-20220826133259-d2e361789965 h1:7EYjiKeUFzPeillyJbz2+2iE9tzQONzGEjT16+9GOSg= -github.com/siyuan-note/dejavu v0.0.0-20220826133259-d2e361789965/go.mod h1:13OMKImGR6k46ZWXRoPJSVTbWSNiTInCAHz72XSjX8I= +github.com/siyuan-note/dejavu v0.0.0-20220827102004-e48207424bf0 h1:94HmsDNBP0O48r8tEdyt4j7jOZjz5VD2QxQvnWD3j54= +github.com/siyuan-note/dejavu v0.0.0-20220827102004-e48207424bf0/go.mod h1:c88CLN+D0WKsh7xahM9/NioVbLIpSdkGx/+gbCEKXhs= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw= github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f h1:JMobMNZ7AqaKKyEK+WeWFhix/2TDQXgPZDajU00IybU= github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f/go.mod h1:Sqo4FYX5lAXu7gWkbEdJF0e6P57tNNVV4WDKYDctokI= github.com/siyuan-note/filelock v0.0.0-20220720144616-011221f7e128 h1:p90RgCJ0BFRY60wOFQ+XHAgI6ey3sUWbqHcQ7T3KWfQ= github.com/siyuan-note/filelock v0.0.0-20220720144616-011221f7e128/go.mod h1:NeC98UUl+U62YScI0qWIjzrK+L4Z6WsBL5bueShjBKs= -github.com/siyuan-note/httpclient v0.0.0-20220826133000-34b9da3530d9 h1:PG3zufBNHWarsVC1t3vRH9wdtQ+NuEiWvLzgNny+tNw= -github.com/siyuan-note/httpclient v0.0.0-20220826133000-34b9da3530d9/go.mod h1:QZw3h+/U3KnPqUyPYuS/b1iPNVRRXyR/L85a+Zj+DyE= +github.com/siyuan-note/httpclient v0.0.0-20220827101805-6352f741c2f1 h1:kqrqD2uZBKS99Q2oVR/oElU1pH915NCzWvNOm0BOhnc= +github.com/siyuan-note/httpclient v0.0.0-20220827101805-6352f741c2f1/go.mod h1:f2vTw7CBb8SjKpXfX4Va2DC539eQ42YpuMLTlbgM2WE= github.com/siyuan-note/logging v0.0.0-20220717040626-f796b05ee520 h1:kscYjMt7jXYdd7Qj2OSUoBnoHc5B0U/E6OSx86VRLr4= github.com/siyuan-note/logging v0.0.0-20220717040626-f796b05ee520/go.mod h1:t1zRGxK13L/9ZFoGyTD39IbFCbee3CsypDj4b5dt4qM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= @@ -421,8 +421,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220824171710-5757bc0c5503 h1:vJ2V3lFLg+bBhgroYuRfyN583UzVveQmIXjc8T/y3to= -golang.org/x/crypto v0.0.0-20220824171710-5757bc0c5503/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d h1:3qF+Z8Hkrw9sOhrFHti9TlB1Hkac1x+DNRkv0XQiFjo= +golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= @@ -465,8 +465,8 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220802222814-0bcc04d9c69b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.0.0-20220822230855-b0a4917ee28c h1:JVAXQ10yGGVbSyoer5VILysz6YKjdNT2bsvlayjqhes= -golang.org/x/net v0.0.0-20220822230855-b0a4917ee28c/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b h1:ZmngSVLe/wycRns9MKikG9OWIEjGcGAkacif7oYQaUY= +golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index 3487d8e5b..54e182a8d 100644 --- a/kernel/model/transaction.go +++ b/kernel/model/transaction.go @@ -40,10 +40,6 @@ import ( "github.com/siyuan-note/siyuan/kernel/util" ) -var ( - ErrNotFullyBoot = errors.New("the kernel has not been fully booted, please try again later") -) - var writingDataLock = sync.Mutex{} func IsFoldHeading(transactions *[]*Transaction) bool { @@ -171,11 +167,6 @@ func mergeTx() (ret *Transaction) { } func PerformTransactions(transactions *[]*Transaction) (err error) { - if !util.IsBooted() { - err = ErrNotFullyBoot - return - } - txQueueLock.Lock() txQueue = append(txQueue, *transactions...) txQueueLock.Unlock()