Reduce running of background tasks on sleep mode

This commit is contained in:
Vladimir Stoilov
2023-04-19 17:47:16 +02:00
parent 4784799541
commit 7e09245540
6 changed files with 34 additions and 9 deletions

View File

@@ -53,9 +53,13 @@ func (p *Process) Save() {
p.UpdateMeta()
if p.processKey == "" {
p.processKey = getProcessKey(int32(p.Pid), p.CreatedAt)
}
if !p.KeyIsSet() {
// set key
p.SetKey(fmt.Sprintf("%s/%s", processDatabaseNamespace, getProcessKey(int32(p.Pid), p.CreatedAt)))
p.SetKey(fmt.Sprintf("%s/%s", processDatabaseNamespace, p.processKey))
// save
processesLock.Lock()