mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-08 17:58:50 +01:00
♻️ Implement some delayed kernel events using task queues https://github.com/siyuan-note/siyuan/issues/12393
This commit is contained in:
parent
9088e49a76
commit
09eec52a02
10 changed files with 79 additions and 44 deletions
|
|
@ -3582,7 +3582,7 @@ func updateBoundBlockAvsAttribute(avIDs []string) {
|
|||
}
|
||||
|
||||
func ReloadAttrView(avID string) {
|
||||
task.AppendTaskWithDelay(task.ReloadAttributeView, 200*time.Millisecond, pushReloadAttrView, avID)
|
||||
task.AppendAsyncTaskWithDelay(task.ReloadAttributeView, 200*time.Millisecond, pushReloadAttrView, avID)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,10 +105,7 @@ func BatchUpdateBazaarPackages(frontend string) {
|
|||
}
|
||||
|
||||
util.ReloadUI()
|
||||
go func() {
|
||||
util.WaitForUILoaded()
|
||||
task.AppendTaskWithDelay(task.PushMsg, 1*time.Second, util.PushMsg, fmt.Sprintf(Conf.language(237), total), 5000)
|
||||
}()
|
||||
task.AppendAsyncTaskWithDelay(task.PushMsg, 3*time.Second, util.PushMsg, fmt.Sprintf(Conf.language(237), total), 5000)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ func refreshSubscriptionExpirationRemind() {
|
|||
now := time.Now().UnixMilli()
|
||||
if now >= expired { // 已经过期
|
||||
if now-expired <= 1000*60*60*24*2 { // 2 天内提醒 https://github.com/siyuan-note/siyuan/issues/7816
|
||||
task.AppendTaskWithDelay(task.PushMsg, 30*time.Second, util.PushErrMsg, Conf.Language(128), 0)
|
||||
task.AppendAsyncTaskWithDelay(task.PushMsg, 30*time.Second, util.PushErrMsg, Conf.Language(128), 0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
@ -250,8 +250,7 @@ func refreshSubscriptionExpirationRemind() {
|
|||
}
|
||||
|
||||
if 0 < remains && expireDay > remains {
|
||||
util.WaitForUILoaded()
|
||||
task.AppendTaskWithDelay(task.PushMsg, 7*time.Second, util.PushErrMsg, fmt.Sprintf(Conf.Language(127), remains), 0)
|
||||
task.AppendAsyncTaskWithDelay(task.PushMsg, 7*time.Second, util.PushErrMsg, fmt.Sprintf(Conf.Language(127), remains), 0)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -470,9 +470,9 @@ func InitConf() {
|
|||
go func() {
|
||||
util.WaitForUILoaded()
|
||||
if util.ContainerIOS == util.Container || util.ContainerAndroid == util.Container {
|
||||
task.AppendTaskWithDelay(task.PushMsg, 2*time.Second, util.PushMsg, Conf.language(245), 15000)
|
||||
task.AppendAsyncTaskWithDelay(task.PushMsg, 2*time.Second, util.PushMsg, Conf.language(245), 15000)
|
||||
} else {
|
||||
task.AppendTaskWithDelay(task.PushMsg, 2*time.Second, util.PushMsg, Conf.language(244), 15000)
|
||||
task.AppendAsyncTaskWithDelay(task.PushMsg, 2*time.Second, util.PushMsg, Conf.language(244), 15000)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -256,10 +256,7 @@ func resetDuplicateBlocksOnFileSys() {
|
|||
|
||||
if needRefreshUI {
|
||||
util.ReloadUI()
|
||||
go func() {
|
||||
util.WaitForUILoaded()
|
||||
task.AppendTaskWithDelay(task.PushMsg, 3*time.Second, util.PushMsg, Conf.Language(190), 5000)
|
||||
}()
|
||||
task.AppendAsyncTaskWithDelay(task.PushMsg, 3*time.Second, util.PushMsg, Conf.Language(190), 5000)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ func Mount(boxID string) (alreadyMount bool, err error) {
|
|||
Conf.Save()
|
||||
}
|
||||
|
||||
task.AppendTaskWithDelay(task.PushMsg, 3*time.Second, util.PushErrMsg, Conf.Language(52), 7000)
|
||||
task.AppendAsyncTaskWithDelay(task.PushMsg, 3*time.Second, util.PushErrMsg, Conf.Language(52), 7000)
|
||||
go func() {
|
||||
// 每次打开帮助文档时自动检查版本更新并提醒 https://github.com/siyuan-note/siyuan/issues/5057
|
||||
time.Sleep(time.Second * 10)
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ func ResetRepo() (err error) {
|
|||
Conf.Save()
|
||||
|
||||
util.PushUpdateMsg(msgId, Conf.Language(145), 3000)
|
||||
task.AppendTaskWithDelay(task.ReloadUI, 2*time.Second, util.ReloadUI)
|
||||
task.AppendAsyncTaskWithDelay(task.ReloadUI, 2*time.Second, util.ReloadUI)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -656,10 +656,7 @@ func checkoutRepo(id string) {
|
|||
task.AppendTask(task.ReloadUI, util.ReloadUIResetScroll)
|
||||
|
||||
if syncEnabled {
|
||||
func() {
|
||||
time.Sleep(5 * time.Second)
|
||||
util.PushMsg(Conf.Language(134), 0)
|
||||
}()
|
||||
task.AppendAsyncTaskWithDelay(task.PushMsg, 3*time.Second, util.PushMsg, Conf.Language(134), 0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue