Skip to content

Commit

Permalink
add debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
will-lol committed Mar 5, 2024
1 parent 03d8933 commit ef96d6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 5 additions & 0 deletions services/notifications/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,14 @@ func (n notificationsService) Notify() (err error) {
}

func (n notificationsService) notifySubscriber(sub Subscription) error {
n.Log.Debug("notify subscriber")
pub, err := n.GetPubKey()
priv, err := n.GetPrivKey()
if err != nil {
return err
}
n.Log.Debug("got keys")
n.Log.Debug("sending using webpush")
resp, err := webpush.SendNotification([]byte("Notification received"), &sub, &webpush.Options{
VAPIDPublicKey: *pub,
VAPIDPrivateKey: *priv,
Expand All @@ -160,7 +163,9 @@ func (n notificationsService) notifySubscriber(sub Subscription) error {
if err != nil {
return err
}
n.Log.Debug("sent")
if resp.StatusCode == 410 {
n.Log.Debug("deleting")
n.db.DeleteObject(sub)
}
return nil
Expand Down
2 changes: 0 additions & 2 deletions services/url/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package url
import (
"context"
"errors"
"fmt"
"log/slog"
"net/url"
)
Expand All @@ -14,7 +13,6 @@ func GetURL(ctx context.Context) (*url.URL, error) {
if req, ok := ctx.Value("url").(*url.URL); ok {
req.Host = hostname
req.Scheme = "https"
fmt.Println(req.String())
return req, nil
}
return nil, errors.New("couldn't get url")
Expand Down

0 comments on commit ef96d6c

Please sign in to comment.