Skip to content

Conversation

@luisdavim
Copy link

Keep reusable clients by username.

@luisdavim luisdavim force-pushed the reuse_clients branch 3 times, most recently from 49c3f50 to d2aa028 Compare October 7, 2022 13:54
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and sorry for delay. One comment, otherwise LGTM!

@luisdavim luisdavim force-pushed the reuse_clients branch 4 times, most recently from 2666fe6 to b902c33 Compare November 23, 2022 09:10
@luisdavim
Copy link
Author

@bwplotka I made the changes you suggested.

@holger-waschke
Copy link
Contributor

I an error assignment to entry in nil map

 ./jiralert   -listen-address 0.0.0.0:9099   -hash-jira-label
level=info ts=2023-10-18T12:35:04.436816899Z caller=main.go:65 msg="starting JIRAlert" version="<local build>"
level=info ts=2023-10-18T12:35:04.436879529Z caller=config.go:62 msg="loading configuration" path=config/jiralert.yml
level=info ts=2023-10-18T12:35:04.437967933Z caller=main.go:135 msg=listening address=0.0.0.0:9099
2023/10/18 14:35:07 http: panic serving 192.168.48.1:52577: assignment to entry in nil map
goroutine 37 [running]:
net/http.(*conn).serve.func1()
        /usr/lib/go-1.20/src/net/http/server.go:1854 +0xbf
panic({0x972e60, 0xada4c0})
        /usr/lib/go-1.20/src/runtime/panic.go:890 +0x263
github.com/prometheus-community/jiralert/pkg/clientset.(*ClientSet).newJira(0xc0002a4e40, 0xc000254500)
        /home/holge/git/jiralert/pkg/clientset/clientset.go:68 +0x35d
github.com/prometheus-community/jiralert/pkg/clientset.(*ClientSet).GetOrCreateJira(0xc000210870?, 0xc0002a9180?)
        /home/holge/git/jiralert/pkg/clientset/clientset.go:76 +0x19
main.main.func1({0xadeb60, 0xc000216460}, 0xc000255200)
        /home/holge/git/jiralert/cmd/jiralert/main.go:105 +0x497
net/http.HandlerFunc.ServeHTTP(0xc000216460?, {0xadeb60?, 0xc000216460?}, 0xa10a73?)
        /usr/lib/go-1.20/src/net/http/server.go:2122 +0x2f
net/http.(*ServeMux).ServeHTTP(0x0?, {0xadeb60, 0xc000216460}, 0xc000255200)
        /usr/lib/go-1.20/src/net/http/server.go:2500 +0x149
net/http.serverHandler.ServeHTTP({0xadd598?}, {0xadeb60, 0xc000216460}, 0xc000255200)
        /usr/lib/go-1.20/src/net/http/server.go:2936 +0x316
net/http.(*conn).serve(0xc00024a630, {0xadf0f0, 0xc0002adc80})
        /usr/lib/go-1.20/src/net/http/server.go:1995 +0x612
created by net/http.(*Server).Serve
        /usr/lib/go-1.20/src/net/http/server.go:3089 +0x5ed

@holger-waschke
Copy link
Contributor

It really was only a missing map initialization

c.jira = map[string]*jira.Client{}

@luisdavim
Copy link
Author

It really was only a missing map initialization

c.jira = map[string]*jira.Client{}

Updated, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants