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
ac0564dc
Commit
ac0564dc
authored
2 years ago
by
benjamin
Browse files
Options
Downloads
Patches
Plain Diff
improved code quality on the selection of the identtiy range
parent
bfbe7df8
No related branches found
No related tags found
2 merge requests
!510
Release
,
!428
built the system to sequentually pick up old ephemerals, breaks interfaces and tests
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmix/identity/tracker.go
+8
-3
8 additions, 3 deletions
cmix/identity/tracker.go
with
8 additions
and
3 deletions
cmix/identity/tracker.go
+
8
−
3
View file @
ac0564dc
...
...
@@ -47,6 +47,11 @@ const (
// NetworkRetention is how long messages are
// retained on the network
NetworkRetention
=
500
*
time
.
Hour
// GenerationDelta is how far into the past
// to go in order to ensure all relevant
// ephemeral identities are generated
GenerationDelta
=
time
.
Duration
(
ephemeral
.
Period
)
+
(
5
*
time
.
Second
)
)
type
Tracker
interface
{
...
...
@@ -133,7 +138,7 @@ func (t *manager) StartProcesses() stoppable.Stoppable {
// AddIdentity adds an identity to be tracked.
func
(
t
*
manager
)
AddIdentity
(
id
*
id
.
ID
,
validUntil
time
.
Time
,
persistent
bool
)
{
lastGeneration
:=
netTime
.
Now
()
.
Add
(
-
time
.
Duration
(
ephemeral
.
Period
)
)
lastGeneration
:=
netTime
.
Now
()
.
Add
(
-
GenerationDelta
)
t
.
newIdentity
<-
TrackedID
{
NextGeneration
:
netTime
.
Now
()
.
Add
(
-
time
.
Second
),
LastGeneration
:
lastGeneration
,
...
...
@@ -152,8 +157,8 @@ func (t *manager) AddIdentityWithHistory(id *id.ID, validUntil, historicalBeginn
}
if
now
:=
time
.
Now
();
historicalBeginning
.
After
(
now
)
||
now
.
Sub
(
historicalBeginning
)
<
time
.
Duration
(
ephemeral
.
Period
)
{
historicalBeginning
=
now
.
Add
(
-
time
.
Duration
(
ephemeral
.
Period
)
)
now
.
Sub
(
historicalBeginning
)
<
GenerationDelta
{
historicalBeginning
=
now
.
Add
(
-
GenerationDelta
)
}
t
.
newIdentity
<-
TrackedID
{
...
...
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