mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-03 00:12:42 +08:00
🎨 Improve ms defender check
This commit is contained in:
parent
3807f8386c
commit
4e7b0d1125
@ -43,7 +43,7 @@ func StartCron() {
|
|||||||
go every(30*time.Second, model.FlushAssetsTextsJob)
|
go every(30*time.Second, model.FlushAssetsTextsJob)
|
||||||
go every(30*time.Second, model.HookDesktopUIProcJob)
|
go every(30*time.Second, model.HookDesktopUIProcJob)
|
||||||
go every(24*time.Hour, model.AutoPurgeRepoJob)
|
go every(24*time.Hour, model.AutoPurgeRepoJob)
|
||||||
go every(30*time.Minute, model.AutoProcessMicrosoftDefender)
|
go every(30*time.Minute, model.AutoCheckMicrosoftDefender)
|
||||||
}
|
}
|
||||||
|
|
||||||
func every(interval time.Duration, f func()) {
|
func every(interval time.Duration, f func()) {
|
||||||
|
@ -21,6 +21,10 @@ package model
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/88250/gulu"
|
||||||
|
"github.com/siyuan-note/logging"
|
||||||
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
|
"golang.org/x/sys/windows"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -28,11 +32,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"time"
|
||||||
"github.com/88250/gulu"
|
|
||||||
"github.com/siyuan-note/logging"
|
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
|
||||||
"golang.org/x/sys/windows"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var microsoftDefenderLock = sync.Mutex{}
|
var microsoftDefenderLock = sync.Mutex{}
|
||||||
@ -98,11 +98,8 @@ func AddMicrosoftDefenderExclusion() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func AutoProcessMicrosoftDefender() {
|
func AutoCheckMicrosoftDefender() {
|
||||||
checkMicrosoftDefender()
|
time.Sleep(7 * time.Second)
|
||||||
}
|
|
||||||
|
|
||||||
func checkMicrosoftDefender() {
|
|
||||||
microsoftDefenderLock.Lock()
|
microsoftDefenderLock.Lock()
|
||||||
defer microsoftDefenderLock.Unlock()
|
defer microsoftDefenderLock.Unlock()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user