Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
d2ad25ef
Commit
d2ad25ef
authored
Oct 25, 2023
by
Luis Marcano
Committed by
Stefan
Oct 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix race condition
fix: import formatting; LastUpdate as atomic.Int64 fix ci/cd
parent
bf530470
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
scorebook.go
op-node/p2p/store/scorebook.go
+5
-3
No files found.
op-node/p2p/store/scorebook.go
View file @
d2ad25ef
...
...
@@ -2,6 +2,7 @@ package store
import
(
"context"
"sync/atomic"
"time"
"github.com/ethereum-optimism/optimism/op-service/clock"
...
...
@@ -17,17 +18,18 @@ const (
var
scoresBase
=
ds
.
NewKey
(
"/peers/scores"
)
// LastUpdate requires atomic update operations. Use the helper functions SetLastUpdated and LastUpdated to modify and access this field.
type
scoreRecord
struct
{
PeerScores
PeerScores
`json:"peerScores"`
LastUpdate
int64
`json:"lastUpdate"`
// unix timestamp in seconds
PeerScores
PeerScores
`json:"peerScores"`
}
func
(
s
*
scoreRecord
)
SetLastUpdated
(
t
time
.
Time
)
{
s
.
LastUpdate
=
t
.
Unix
(
)
atomic
.
StoreInt64
(
&
s
.
LastUpdate
,
t
.
Unix
()
)
}
func
(
s
*
scoreRecord
)
LastUpdated
()
time
.
Time
{
return
time
.
Unix
(
s
.
LastUpdate
,
0
)
return
time
.
Unix
(
atomic
.
LoadInt64
(
&
s
.
LastUpdate
)
,
0
)
}
func
(
s
*
scoreRecord
)
MarshalBinary
()
(
data
[]
byte
,
err
error
)
{
...
...
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