Skip to content

Commit 66133eb

Browse files
committed
amstate: fix inconsistent ("s" AND "c") use if "this" variables
1 parent 2ac0016 commit 66133eb

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

pkg/amstate/store.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -121,63 +121,63 @@ func (s *Store) LastUnnoticedAlertsNotified() time.Time {
121121
return s.state.LastUnnoticedAlertsNotified
122122
}
123123

124-
func (c *Store) GetEventTypes() ehevent.Allocators {
124+
func (s *Store) GetEventTypes() ehevent.Allocators {
125125
return amdomain.Types
126126
}
127127

128-
func (c *Store) ProcessEvents(_ context.Context, processAndCommit ehreader.EventProcessorHandler) error {
129-
c.mu.Lock()
130-
defer c.mu.Unlock()
128+
func (s *Store) ProcessEvents(_ context.Context, processAndCommit ehreader.EventProcessorHandler) error {
129+
s.mu.Lock()
130+
defer s.mu.Unlock()
131131

132132
return processAndCommit(
133-
c.version,
134-
func(ev ehevent.Event) error { return c.processEvent(ev) },
133+
s.version,
134+
func(ev ehevent.Event) error { return s.processEvent(ev) },
135135
func(version ehclient.Cursor) error {
136-
c.version = version
136+
s.version = version
137137
return nil
138138
})
139139
}
140140

141-
func (c *Store) processEvent(ev ehevent.Event) error {
142-
c.logl.Debug.Println(ev.MetaType())
141+
func (s *Store) processEvent(ev ehevent.Event) error {
142+
s.logl.Debug.Println(ev.MetaType())
143143

144144
switch e := ev.(type) {
145145
case *amdomain.AlertRaised:
146-
c.state.ActiveAlerts[e.Id] = Alert{
146+
s.state.ActiveAlerts[e.Id] = Alert{
147147
Id: e.Id,
148148
Subject: e.Subject,
149149
Details: e.Details,
150150
Timestamp: e.Meta().Timestamp,
151151
}
152152
case *amdomain.AlertAcknowledged:
153-
delete(c.state.ActiveAlerts, e.Id)
153+
delete(s.state.ActiveAlerts, e.Id)
154154
case *amdomain.HttpMonitorCreated:
155-
c.state.HttpMonitors[e.Id] = HttpMonitor{
155+
s.state.HttpMonitors[e.Id] = HttpMonitor{
156156
Id: e.Id,
157157
Created: e.Meta().Timestamp,
158158
Enabled: e.Enabled,
159159
Url: e.Url,
160160
Find: e.Find,
161161
}
162162
case *amdomain.HttpMonitorEnabledUpdated:
163-
mon := c.state.HttpMonitors[e.Id]
163+
mon := s.state.HttpMonitors[e.Id]
164164
mon.Enabled = e.Enabled
165-
c.state.HttpMonitors[e.Id] = mon
165+
s.state.HttpMonitors[e.Id] = mon
166166
case *amdomain.HttpMonitorDeleted:
167-
delete(c.state.HttpMonitors, e.Id)
167+
delete(s.state.HttpMonitors, e.Id)
168168
case *amdomain.DeadMansSwitchCreated:
169-
c.state.DeadMansSwitches[e.Subject] = DeadMansSwitch{
169+
s.state.DeadMansSwitches[e.Subject] = DeadMansSwitch{
170170
Subject: e.Subject,
171171
Ttl: e.Ttl,
172172
}
173173
case *amdomain.DeadMansSwitchCheckin:
174-
dms := c.state.DeadMansSwitches[e.Subject]
174+
dms := s.state.DeadMansSwitches[e.Subject]
175175
dms.Ttl = e.Ttl
176-
c.state.DeadMansSwitches[e.Subject] = dms
176+
s.state.DeadMansSwitches[e.Subject] = dms
177177
case *amdomain.DeadMansSwitchDeleted:
178-
delete(c.state.DeadMansSwitches, e.Subject)
178+
delete(s.state.DeadMansSwitches, e.Subject)
179179
case *amdomain.UnnoticedAlertsNotified:
180-
c.state.LastUnnoticedAlertsNotified = e.Meta().Timestamp
180+
s.state.LastUnnoticedAlertsNotified = e.Meta().Timestamp
181181
default:
182182
return ehreader.UnsupportedEventTypeErr(ev)
183183
}

0 commit comments

Comments
 (0)