Skip to content

Commit

Permalink
Don't cache incident events in-memory
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed May 4, 2023
1 parent c9ab469 commit 4729fc2
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions internal/incident/incident.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type Incident struct {

EscalationState map[escalationID]*EscalationState
Rules map[ruleID]struct{}
Events []*event.Event
Recipients map[RecipientKey]*RecipientState
History []*HistoryEntry

Expand Down Expand Up @@ -122,11 +121,8 @@ func (i *Incident) AddEscalationTriggered(state *EscalationState, history *Histo
return i.AddHistory(history, hr, true)
}

// AddEvent adds the given event to this incident events slice.
// Inserts also incident history record to the database and returns an error on db failure.
// AddEvent Inserts incident history record to the database and returns an error on db failure.
func (i *Incident) AddEvent(db *icingadb.DB, ev *event.Event) error {
i.Events = append(i.Events, ev)

ie := &EventRow{IncidentID: i.incidentRowID, EventID: ev.ID}
stmt, _ := db.BuildInsertStmt(ie)
_, err := db.NamedExec(stmt, ie)
Expand Down

0 comments on commit 4729fc2

Please sign in to comment.