mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
Stop useless updating of app compat warning
This commit is contained in:
parent
1dde1437b6
commit
1462bd07ff
1 changed files with 12 additions and 3 deletions
|
@ -148,14 +148,23 @@ func (issue *appIssue) notify(proc *process.Process) {
|
|||
|
||||
// Set warning on profile.
|
||||
module.StartWorker("set app compat warning", func(ctx context.Context) error {
|
||||
var changed bool
|
||||
|
||||
func() {
|
||||
p.Lock()
|
||||
defer p.Unlock()
|
||||
|
||||
p.Warning = fmt.Sprintf(issue.message, p.Name)
|
||||
warningMsg := fmt.Sprintf(issue.message, p.Name)
|
||||
if p.Warning != warningMsg || time.Now().Add(-1*time.Hour).After(p.WarningLastUpdated) {
|
||||
p.Warning = warningMsg
|
||||
p.WarningLastUpdated = time.Now()
|
||||
changed = true
|
||||
}
|
||||
}()
|
||||
|
||||
if changed {
|
||||
return p.Save()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue