use the new atomic types introduced in Go 1.19

we depend on Go 1.19 anyway

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2022-08-30 15:47:41 +02:00
parent da03f6c4e3
commit 95e9106902
22 changed files with 231 additions and 231 deletions

View File

@@ -82,7 +82,7 @@ func HandleCertificateEvent(params EventParams) {
// eventRulesContainer stores event rules by trigger
type eventRulesContainer struct {
sync.RWMutex
lastLoad int64
lastLoad atomic.Int64
FsEvents []dataprovider.EventRule
ProviderEvents []dataprovider.EventRule
Schedules []dataprovider.EventRule
@@ -101,11 +101,11 @@ func (r *eventRulesContainer) removeAsyncTask() {
}
func (r *eventRulesContainer) getLastLoadTime() int64 {
return atomic.LoadInt64(&r.lastLoad)
return r.lastLoad.Load()
}
func (r *eventRulesContainer) setLastLoadTime(modTime int64) {
atomic.StoreInt64(&r.lastLoad, modTime)
r.lastLoad.Store(modTime)
}
// RemoveRule deletes the rule with the specified name