Race conditions if used throughout app
ericlagergren opened this issue · 0 comments
Re: https://twitter.com/ELagergren/status/637004901470441472
Basically, if my folder structure looks like this:
eric@archbox ~/gopath/src/github.com/SermoDigital/sermocrm $ tree
.
├── app.go
├── auth
│ ├── auth
│ │ └── ServerSession.go
│ ├── auth.go
│ ├── auth_test.go
│ ├── csrf.go
│ ├── errors.go
│ ├── gorilla_session.go
│ ├── marshal.go
│ ├── password_map.go
│ ├── rate_limit.go
│ ├── server_session_contextkey.go
│ ├── server_session.fbs
│ ├── server_session.go
│ ├── server_session_test.go
│ ├── tfa
│ │ ├── tfa.go
│ │ └── tfa_sql.go
│ └── types.go
├── build.bash
├── config
│ ├── config.go
│ ├── config.toml
│ ├── database.sql
│ ├── db_funcs.go
│ └── load_config.go
├── controllers
│ ├── about.go
│ ├── account.go
│ ├── create.go
│ ├── dashboard.go
│ ├── domains.go
...
and I want to use raygun4go in multiple places, I'd have to create a new src-level folder containing my raygun.Client
configuration. (To prevent having one *Client per specific .go
file.)
However, if I use *Client.Version
or any related methods inside, say, an http.Handler
, I'd run into a race condition where two handlers could fire at the same time both overwriting the global *Client.Version
member.
I forked this and created a temporary fix seen here: https://github.com/SermoDigital/raygun4go/commit/67168a71d43dec4935563bb50e20245975e7702e
It's just temporary until you guys get something more substantial out, because I didn't feel like rewriting the entire API 😁