Skip to content

Commit

Permalink
Some sentry fixes.
Browse files Browse the repository at this point in the history
Sentry can only capture panics from the current goroutine getsentry/raven-go#95 with makes wrapping pusher.start in capturePanic useless.
  • Loading branch information
cscatolini committed Jan 19, 2017
1 parent e8d531e commit d66d1c1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,7 @@ The GCM library we're using requires that we specify a ping interval and timeout
GCM supports at most 100 pending messages (see [Flow Control section](https://developers.google.com/cloud-messaging/ccs#flow) in GCM documentation).

* `PUSHER_GCM_MAXPENDINGMESSAGES` - Max pending messages;

If you wish Sentry integration simply set the following environment variable:

* `PUSHER_SENTRY_URL` - Sentry Client Key (DSN);
18 changes: 8 additions & 10 deletions cmd/apns.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,21 @@ var apnsCmd = &cobra.Command{
if err != nil {
panic(err)
}
apnsPusher, err := startApns(debug, json, production, certificate, config, nil, nil, nil)
if err != nil {
panic(err)
}

sentryURL := config.GetString("sentry.url")
if sentryURL == "" {
apnsPusher.Start()
} else {
if sentryURL != "" {
raven.SetDSN(sentryURL)
raven.CapturePanic(func() {
apnsPusher.Start()
}, map[string]string{
}

apnsPusher, err := startApns(debug, json, production, certificate, config, nil, nil, nil)
if err != nil {
raven.CaptureErrorAndWait(err, map[string]string{
"version": util.Version,
"cmd": "apns",
})
panic(err)
}
apnsPusher.Start()
},
}

Expand Down
19 changes: 8 additions & 11 deletions cmd/gcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,20 @@ var gcmCmd = &cobra.Command{
panic(err)
}

gcmPusher, err := startGcm(debug, json, production, senderID, apiKey, config, nil, nil, nil)
if err != nil {
panic(err)
}

sentryURL := config.GetString("sentry.url")
if sentryURL == "" {
gcmPusher.Start()
} else {
if sentryURL != "" {
raven.SetDSN(sentryURL)
raven.CapturePanic(func() {
gcmPusher.Start()
}, map[string]string{
}

gcmPusher, err := startGcm(debug, json, production, senderID, apiKey, config, nil, nil, nil)
if err != nil {
raven.CaptureErrorAndWait(err, map[string]string{
"version": util.Version,
"cmd": "gcm",
})
panic(err)
}
gcmPusher.Start()
},
}

Expand Down
4 changes: 4 additions & 0 deletions docs/hosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ GCM supports at most 100 pending messages (see [Flow Control section](https://de

* `PUSHER_GCM_MAXPENDINGMESSAGES` - Max pending messages;

If you wish Sentry integration simply set the following environment variable:

* `PUSHER_SENTRY_URL` - Sentry Client Key (DSN);

### Example command for running with Docker

```
Expand Down

0 comments on commit d66d1c1

Please sign in to comment.