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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
bd006184
Commit
bd006184
authored
2 years ago
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
Add ReadyToSend, which checks if the network is ready to send on
parent
e6e5bd56
No related branches found
No related tags found
3 merge requests
!510
Release
,
!419
rewrote the health tracker to both consider if there are waiting rounds and...
,
!340
Project/channels
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/follow.go
+20
-0
20 additions, 0 deletions
bindings/follow.go
with
20 additions
and
0 deletions
bindings/follow.go
+
20
−
0
View file @
bd006184
...
...
@@ -10,6 +10,7 @@ package bindings
import
(
"encoding/json"
"fmt"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/cmix/message"
"time"
...
...
@@ -82,6 +83,25 @@ func (c *Cmix) WaitForNetwork(timeoutMS int) bool {
return
false
}
// ReadyToSend determines if the network is ready to send messages on. It
// returns true if the network is healthy and if the client has registered with
// at least 70% of the nodes. Returns false otherwise.
func
(
c
*
Cmix
)
ReadyToSend
()
bool
{
// Check if the network is currently healthy
if
!
c
.
api
.
GetCmix
()
.
IsHealthy
()
{
return
false
}
// If the network is healthy, then check the number of nodes that the client
// is currently registered with
numReg
,
total
,
err
:=
c
.
api
.
GetNodeRegistrationStatus
()
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"Failed to get node registration status: %+v"
,
err
)
}
return
numReg
>=
total
*
7
/
10
}
// NetworkFollowerStatus gets the state of the network follower. It returns a
// status with the following values:
// Stopped - 0
...
...
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