mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🐛 Fix cron job setup https://github.com/siyuan-note/siyuan/issues/14817
This commit is contained in:
parent
7120e1e8ae
commit
31c7fd13b6
1 changed files with 10 additions and 0 deletions
|
|
@ -52,6 +52,16 @@ func StartCron() {
|
|||
|
||||
func every(interval time.Duration, f func(), name ...string) {
|
||||
util.RandomSleep(50, 200)
|
||||
|
||||
// 启动后立即执行一次
|
||||
func() {
|
||||
defer logging.Recover()
|
||||
f()
|
||||
if 0 < len(name) {
|
||||
logging.LogInfof("cron job [%s] executed", name)
|
||||
}
|
||||
}()
|
||||
|
||||
ticker := time.NewTicker(interval)
|
||||
defer ticker.Stop()
|
||||
for range ticker.C {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue