Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
notifications-bot
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package 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
archives
notifications-bot
Commits
63e5de49
Commit
63e5de49
authored
Apr 13, 2021
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Add NDF thread with initial (failing) test for feedback
parent
d26ec3d9
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
notifications/ndf.go
+4
-5
4 additions, 5 deletions
notifications/ndf.go
notifications/ndf_test.go
+5
-5
5 additions, 5 deletions
notifications/ndf_test.go
with
9 additions
and
10 deletions
notifications/ndf.go
+
4
−
5
View file @
63e5de49
...
...
@@ -16,13 +16,14 @@ import (
"gitlab.com/elixxir/notifications-bot/io"
"gitlab.com/xx_network/comms/connect"
//"gitlab.com/elixxir/comms/notificationBot"
"time"
"bytes"
"gitlab.com/elixxir/crypto/hash"
"time"
)
// Stopper function that stops the thread on a timeout
type
Stopper
func
(
timeout
time
.
Duration
)
bool
// GatewaysChanged function processes the gateways changed event when detected
// in the NDF
type
GatewaysChanged
func
(
ndf
pb
.
NDF
)
...
...
@@ -34,7 +35,6 @@ type InstanceObject interface {
GetPermHost
()
*
connect
.
Host
}
// TrackNdf kicks off the ndf tracking thread
func
TrackNdf
(
i
InstanceObject
)
Stopper
{
// Handler function for the gateways changed event
...
...
@@ -64,7 +64,6 @@ func TrackNdf(i InstanceObject) Stopper {
return
quitFn
}
func
trackNdf
(
poller
io
.
PollingConn
,
quitCh
chan
bool
,
gwEvt
GatewaysChanged
)
{
lastNdfHash
:=
make
([]
byte
,
32
)
pollDelay
:=
1
*
time
.
Second
...
...
This diff is collapsed.
Click to expand it.
notifications/ndf_test.go
+
5
−
5
View file @
63e5de49
...
...
@@ -8,17 +8,17 @@
package
notifications
import
(
"testing"
pb
"gitlab.com/elixxir/comms/mixmessages"
"sync"
"testing"
"time"
)
type
MockPoller
struct
{
ndf
*
pb
.
NDF
sync
.
Mutex
}
func
(
m
MockPoller
)
PollNdf
()
(
*
pb
.
NDF
,
error
)
{
m
.
Lock
()
defer
m
.
Unlock
()
...
...
This diff is collapsed.
Click to expand it.
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