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
401070a2
Commit
401070a2
authored
Feb 11, 2020
by
ksparakis
Browse files
Options
Downloads
Patches
Plain Diff
fix poll ndf logic to loop till it gets the ndf
parent
c5f2e153
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
notifications/updateNDF.go
+8
-4
8 additions, 4 deletions
notifications/updateNDF.go
with
8 additions
and
4 deletions
notifications/updateNDF.go
+
8
−
4
View file @
401070a2
...
...
@@ -10,6 +10,7 @@ package notifications
import
(
"crypto/sha256"
"fmt"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/comms/connect"
...
...
@@ -17,6 +18,7 @@ import (
"gitlab.com/elixxir/primitives/id"
"gitlab.com/elixxir/primitives/ndf"
"strings"
"time"
)
// We use an interface here inorder to allow us to mock the getHost and RequestNDF in the notifcationsBot.Comms for testing
...
...
@@ -44,11 +46,13 @@ func PollNdf(currentDef *ndf.NetworkDefinition, comms notificationComms) (*ndf.N
//Send the hash to registration
response
,
err
:=
comms
.
RequestNdf
(
regHost
,
msg
)
if
err
!=
nil
{
errMsg
:=
errors
.
Errorf
(
"Failed to get ndf from permissioning: %v"
,
err
)
if
strings
.
Contains
(
errMsg
.
Error
(),
ndf
.
NO_NDF
)
{
jww
.
WARN
.
Println
(
"Continuing without an updated NDF"
)
re
turn
nil
,
nil
for
err
!=
nil
&&
strings
.
Contains
(
err
.
Error
(),
ndf
.
NO_NDF
)
{
jww
.
WARN
.
Println
(
"Failed to get an ndf, possibly not ready yet. Retying now..."
)
time
.
Sleep
(
50
*
time
.
Millisecond
)
re
sponse
,
err
=
comms
.
RequestNdf
(
regHost
,
msg
)
}
// If it is not an issue with no ndf, return the error up the stack
errMsg
:=
errors
.
Errorf
(
"Failed to get ndf from permissioning: %v"
,
err
)
return
nil
,
errMsg
}
...
...
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