Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
088e5a6d
Commit
088e5a6d
authored
Jun 16, 2023
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
debug notifications set command
parent
9ef7d0cc
No related branches found
No related tags found
1 merge request
!617
Project/haven beta
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
notifications/notifications.go
+18
-1
18 additions, 1 deletion
notifications/notifications.go
with
18 additions
and
1 deletion
notifications/notifications.go
+
18
−
1
View file @
088e5a6d
...
...
@@ -4,13 +4,15 @@ import (
"bytes"
"encoding/json"
"errors"
"time"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/v4/collective/versioned"
pb
"gitlab.com/elixxir/comms/mixmessages"
notifCrypto
"gitlab.com/elixxir/crypto/notifications"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id/ephemeral"
"gitlab.com/xx_network/primitives/netTime"
"time"
)
func
(
m
*
manager
)
Set
(
toBeNotifiedOn
*
id
.
ID
,
group
string
,
metadata
[]
byte
,
...
...
@@ -19,9 +21,13 @@ func (m *manager) Set(toBeNotifiedOn *id.ID, group string, metadata []byte,
return
err
}
jww
.
INFO
.
Printf
(
"Notifications dummy locking SET"
)
m
.
mux
.
Lock
()
defer
m
.
mux
.
Unlock
()
jww
.
INFO
.
Printf
(
"Notifications dummy locked SET"
)
currentReg
,
exists
:=
m
.
notifications
[
*
toBeNotifiedOn
]
if
exists
{
if
currentReg
.
Group
!=
group
{
...
...
@@ -34,12 +40,18 @@ func (m *manager) Set(toBeNotifiedOn *id.ID, group string, metadata []byte,
}
}
jww
.
INFO
.
Printf
(
"Notifications dummy currentReg"
)
// register with remote
if
status
==
Push
&&
(
!
exists
||
exists
&&
currentReg
.
Status
!=
Push
)
{
jww
.
INFO
.
Printf
(
"Notifications dummy PUSH"
)
if
err
:=
m
.
registerNotification
([]
*
id
.
ID
{
toBeNotifiedOn
});
err
!=
nil
{
return
err
}
}
else
if
status
!=
Push
{
jww
.
INFO
.
Printf
(
"Notifications dummy !PUSH"
)
if
err
:=
m
.
unregisterNotification
([]
*
id
.
ID
{
toBeNotifiedOn
});
err
!=
nil
{
return
err
}
...
...
@@ -54,15 +66,20 @@ func (m *manager) Set(toBeNotifiedOn *id.ID, group string, metadata []byte,
Status
:
status
,
},
}
jww
.
INFO
.
Printf
(
"Notifications dummy storeRegistration"
)
err
:=
m
.
storeRegistration
(
toBeNotifiedOn
,
reg
,
ts
)
if
err
!=
nil
{
return
err
}
jww
.
INFO
.
Printf
(
"Notifications dummy upsert"
)
// update in ram storage
m
.
upsertNotificationUnsafeRAM
(
toBeNotifiedOn
,
reg
)
jww
.
INFO
.
Printf
(
"Notifications dummy CALLBACKS"
)
// call the callback if it exists to notify that an update exists
if
cb
,
cbExists
:=
m
.
callbacks
[
group
];
cbExists
{
// can be nil if the last element was deleted
...
...
This diff is collapsed.
Click to expand it.
Richard T. Carback III
@carback1
mentioned in commit
767a71e0
·
Jun 16, 2023
mentioned in commit
767a71e0
mentioned in commit 767a71e059c2ef5b6f2689cdab3fc8ec6cc698c5
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment