Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Only create connector once to fix ident mangling #460

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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