Skip to content

Commit

Permalink
🐛 [release-0.2] Only create connector once to fix ident mangling (#461)
Browse files Browse the repository at this point in the history
Backport of #460

Signed-off-by: Sam Lucidi <[email protected]>
  • Loading branch information
mansam authored Jul 25, 2023
1 parent 45b0e18 commit d7426a7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tracker/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ func (m *Manager) createPending() {
}
for i := range list {
tracker := &list[i]
conn, err := NewConnector(tracker)
if err != nil {
Log.Error(err, "Unable to build connector for tracker.", "tracker", tracker.ID)
continue
}
for j := range tracker.Tickets {
t := &tracker.Tickets[j]
ago := t.LastUpdated.Add(IntervalCreateRetry)
Expand All @@ -167,7 +172,7 @@ func (m *Manager) createPending() {
if t.Created || (t.Error && !ago.Before(time.Now())) {
continue
}
err := m.create(tracker, t)
err = m.create(conn, t)
if err != nil {
Log.Error(err, "Failed to create ticket.", "ticket", t.ID)
}
Expand All @@ -176,11 +181,7 @@ func (m *Manager) createPending() {
}

// Create the ticket in its tracker.
func (m *Manager) create(tracker *model.Tracker, ticket *model.Ticket) (err error) {
conn, err := NewConnector(tracker)
if err != nil {
return
}
func (m *Manager) create(conn Connector, ticket *model.Ticket) (err error) {
err = conn.Create(ticket)
if err != nil {
return
Expand Down

0 comments on commit d7426a7

Please sign in to comment.