Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
authority
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
katzenpost
authority
Commits
afb9f60e
Commit
afb9f60e
authored
Feb 26, 2019
by
masala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get rid of bootstrap warp
parent
01b7442d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
20 deletions
+9
-20
voting/server/state.go
voting/server/state.go
+9
-20
No files found.
voting/server/state.go
View file @
afb9f60e
...
...
@@ -140,22 +140,22 @@ func (s *state) worker() {
func
(
s
*
state
)
fsm
()
<-
chan
time
.
Time
{
s
.
Lock
()
var
sleep
time
.
Duration
bootsleep
:=
10
*
time
.
Second
epoch
,
elapsed
,
nextEpoch
:=
epochtime
.
Now
()
s
.
log
.
Debugf
(
"Current epoch %d, remaining time: %s"
,
epoch
,
nextEpoch
)
if
nextEpoch
<
2
*
5
*
bootsleep
{
// bootstrap time for current epoch and next epoch
s
.
log
.
Debugf
(
"Too close to epoch boundary, sleeping for %s"
,
nextEpoch
)
<-
time
.
After
(
nextEpoch
)
s
.
votingEpoch
=
epoch
+
1
}
switch
s
.
state
{
case
stateBootstrap
:
s
.
log
.
Debugf
(
"Bootstrapping for %d"
,
s
.
votingEpoch
)
s
.
backgroundFetchConsensus
(
epoch
-
1
)
s
.
backgroundFetchConsensus
(
epoch
)
s
.
log
.
Debugf
(
"Bootstrapping for %d"
,
s
.
votingEpoch
)
if
elapsed
>
mixPublishDeadline
{
s
.
log
.
Debugf
(
"Too late to vote this round, sleeping until %s"
,
nextEpoch
)
sleep
=
nextEpoch
+
mixPublishDeadline
s
.
votingEpoch
=
epoch
+
1
}
else
{
sleep
=
mixPublishDeadline
-
elapsed
}
s
.
state
=
stateAcceptDescriptor
sleep
=
mixPublishDeadline
-
elapsed
case
stateAcceptDescriptor
:
if
!
s
.
hasEnoughDescriptors
(
s
.
descriptors
[
s
.
votingEpoch
])
{
s
.
log
.
Debugf
(
"Not voting because insufficient descriptors uploaded for epoch %d!"
,
s
.
votingEpoch
)
...
...
@@ -189,13 +189,7 @@ func (s *state) fsm() <-chan time.Time {
s
.
consense
(
s
.
votingEpoch
)
if
_
,
ok
:=
s
.
documents
[
s
.
votingEpoch
];
ok
{
s
.
state
=
stateAcceptDescriptor
if
s
.
votingEpoch
==
epoch
{
// either we bootstrapped before the publish deadline
// or we default to 30 seconds
sleep
=
mixPublishDeadline
-
elapsed
}
else
{
sleep
=
mixPublishDeadline
+
nextEpoch
}
sleep
=
mixPublishDeadline
+
nextEpoch
s
.
votingEpoch
++
}
else
{
// failed to make consensus. try to join next round.
...
...
@@ -206,11 +200,6 @@ func (s *state) fsm() <-chan time.Time {
default
:
}
s
.
pruneDocuments
()
if
s
.
votingEpoch
<=
epoch
||
sleep
<
0
{
sec
:=
time
.
Duration
(
time
.
Now
()
.
Second
())
// sleep up to a 30 second increment
sleep
=
bootsleep
-
(
sec
%
bootsleep
)
}
s
.
log
.
Debugf
(
"authority: FSM in state %v until %s"
,
s
.
state
,
sleep
)
s
.
Unlock
()
return
time
.
After
(
sleep
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment