Skip to content
Snippets Groups Projects
Commit 0e3882f5 authored by Jonah Husson's avatar Jonah Husson
Browse files

fix how not found user is represented

parent 70e16c89
No related branches found
No related tags found
No related merge requests found
...@@ -62,12 +62,13 @@ type NotificationComms interface { ...@@ -62,12 +62,13 @@ type NotificationComms interface {
func (nb *Impl) RunNotificationLoop(fbCreds string, loopDuration int, killChan chan struct{}) { func (nb *Impl) RunNotificationLoop(fbCreds string, loopDuration int, killChan chan struct{}) {
fc := firebase.NewFirebaseComm() fc := firebase.NewFirebaseComm()
for { for {
// Stop execution if killed by channel
select { select {
case <-killChan: case <-killChan:
return return
default: default:
} }
// TODO: fill in body of main loop, should poll gateway and send relevant notifications to firebase
UIDs, err := nb.pollFunc(nb) UIDs, err := nb.pollFunc(nb)
if err != nil { if err != nil {
jww.ERROR.Printf("Failed to poll gateway for users to notify: %+v", err) jww.ERROR.Printf("Failed to poll gateway for users to notify: %+v", err)
...@@ -149,7 +150,8 @@ func NewImplementation(instance *Impl) *notificationBot.Implementation { ...@@ -149,7 +150,8 @@ func NewImplementation(instance *Impl) *notificationBot.Implementation {
func notifyUser(uid string, serviceKeyPath string, fc *firebase.FirebaseComm, db storage.Storage) (string, error) { func notifyUser(uid string, serviceKeyPath string, fc *firebase.FirebaseComm, db storage.Storage) (string, error) {
u, err := db.GetUser(uid) u, err := db.GetUser(uid)
if err != nil { if err != nil {
return "", errors.Errorf("Failed to get token for UID %+v: %+v", uid, err) jww.DEBUG.Printf("No registration found for user with ID %+v", uid)
return "", nil
} }
app, ctx, err := fc.SetupMessagingApp(serviceKeyPath) app, ctx, err := fc.SetupMessagingApp(serviceKeyPath)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment