From 2cbaf126e9e9e6b5e0c99c5aa2e4f02333a73708 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 15 Feb 2022 13:59:56 +0100 Subject: [PATCH] Remove deprecated MarkUsed functions --- process/profile.go | 5 +---- profile/profile-layered.go | 5 ----- profile/profile.go | 24 ------------------------ 3 files changed, 1 insertion(+), 33 deletions(-) diff --git a/process/profile.go b/process/profile.go index 381411fd..4a3a3865 100644 --- a/process/profile.go +++ b/process/profile.go @@ -105,11 +105,8 @@ func (p *Process) UpdateProfileMetadata() { // Update metadata of profile. metadataUpdated := localProfile.UpdateMetadata(p.Path) - // Mark profile as used. - profileChanged := localProfile.MarkUsed() - // Save the profile if we changed something. - if metadataUpdated || profileChanged { + if metadataUpdated { err := localProfile.Save() if err != nil { log.Warningf("process: failed to save profile %s: %s", localProfile.ScopedID(), err) diff --git a/profile/profile-layered.go b/profile/profile-layered.go index e3747245..b67e1bca 100644 --- a/profile/profile-layered.go +++ b/profile/profile-layered.go @@ -276,11 +276,6 @@ func (lp *LayeredProfile) updateCaches() { atomic.StoreUint32(lp.securityLevel, uint32(newLevel)) } -// MarkUsed marks the localProfile as used. -func (lp *LayeredProfile) MarkUsed() { - lp.localProfile.MarkUsed() -} - // SecurityLevel returns the highest security level of all layered profiles. This function is atomic and does not require any locking. func (lp *LayeredProfile) SecurityLevel() uint8 { return uint8(atomic.LoadUint32(lp.securityLevel)) diff --git a/profile/profile.go b/profile/profile.go index bb2d44c9..f23dafa2 100644 --- a/profile/profile.go +++ b/profile/profile.go @@ -281,30 +281,6 @@ func (profile *Profile) LastActive() int64 { return atomic.LoadInt64(profile.lastActive) } -// MarkUsed updates ApproxLastUsed when it's been a while and saves the profile if it was changed. -func (profile *Profile) MarkUsed() (changed bool) { - /* - TODO: - This might be one of the things causing problems with disappearing settings. - Possibly this is called with an outdated profile and then kills settings - already in the database. - Generally, it probably causes more harm than good if we periodically touch - the most important database entries just to update a timestamp. - We should save this data elsewhere and make configuration data as stable as - possible. - - profile.Lock() - defer profile.Unlock() - - if time.Now().Add(-lastUsedUpdateThreshold).Unix() > profile.ApproxLastUsed { - profile.ApproxLastUsed = time.Now().Unix() - return true - } - */ - - return false -} - // String returns a string representation of the Profile. func (profile *Profile) String() string { return fmt.Sprintf("<%s %s/%s>", profile.Name, profile.Source, profile.ID)