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
7e5b468d
Commit
7e5b468d
authored
May 30, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fixes to the log store.
parent
365d40ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
17 deletions
+11
-17
log_store.go
op-challenger/challenger/log_store.go
+1
-1
log_store_test.go
op-challenger/challenger/log_store_test.go
+10
-16
No files found.
op-challenger/challenger/log_store.go
View file @
7e5b468d
...
...
@@ -108,7 +108,7 @@ func (l *logStore) buildBackoffStrategy() backoff.Strategy {
// resubscribe attempts to re-establish the log store internal
// subscription with a backoff strategy.
func
(
l
*
logStore
)
resubscribe
(
ctx
context
.
Context
)
error
{
l
.
log
.
Info
(
"
resubscribing
"
)
l
.
log
.
Info
(
"
log store resubscribing with backoff
"
)
backoffStrategy
:=
l
.
buildBackoffStrategy
()
return
backoff
.
DoCtx
(
ctx
,
10
,
backoffStrategy
,
func
()
error
{
if
l
.
subscription
==
nil
{
...
...
op-challenger/challenger/log_store_test.go
View file @
7e5b468d
...
...
@@ -110,7 +110,7 @@ func TestLogStore_Subscribe_ReceivesLogs(t *testing.T) {
}
client
.
logs
<-
mockLog
timeout
,
tCancel
:=
context
.
WithTimeout
(
context
.
Background
(),
5
*
time
.
Second
)
timeout
,
tCancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
tCancel
()
err
:=
e2eutils
.
WaitFor
(
timeout
,
500
*
time
.
Millisecond
,
func
()
(
bool
,
error
)
{
result
:=
logStore
.
GetLogByBlockHash
(
mockLog
.
BlockHash
)
...
...
@@ -126,7 +126,7 @@ func TestLogStore_Subscribe_SubscriptionErrors(t *testing.T) {
client
.
sub
.
errorChan
<-
ErrTestError
timeout
,
tCancel
:=
context
.
WithTimeout
(
context
.
Background
(),
5
*
time
.
Second
)
timeout
,
tCancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
tCancel
()
err
:=
e2eutils
.
WaitFor
(
timeout
,
500
*
time
.
Millisecond
,
func
()
(
bool
,
error
)
{
subcount
:=
client
.
subcount
==
2
...
...
@@ -137,13 +137,10 @@ func TestLogStore_Subscribe_SubscriptionErrors(t *testing.T) {
}
func
TestLogStore_Subscribe_NoClient_Panics
(
t
*
testing
.
T
)
{
defer
func
()
{
if
recover
()
==
nil
{
t
.
Error
(
"expected nil client to panic"
)
}
}()
logStore
,
_
:=
newErrorLogStore
(
t
,
nil
)
require
.
NoError
(
t
,
logStore
.
Subscribe
(
context
.
Background
()))
require
.
Panics
(
t
,
func
()
{
logStore
,
_
:=
newErrorLogStore
(
t
,
nil
)
_
=
logStore
.
Subscribe
(
context
.
Background
())
})
}
func
TestLogStore_Subscribe_ErrorSubscribing
(
t
*
testing
.
T
)
{
...
...
@@ -162,11 +159,8 @@ func TestLogStore_Quit_ResetsSubscription(t *testing.T) {
}
func
TestLogStore_Quit_NoSubscription_Panics
(
t
*
testing
.
T
)
{
defer
func
()
{
if
recover
()
==
nil
{
t
.
Error
(
"expected no subscription to panic"
)
}
}()
logStore
,
_
:=
newErrorLogStore
(
t
,
nil
)
logStore
.
Quit
()
require
.
Panics
(
t
,
func
()
{
logStore
,
_
:=
newErrorLogStore
(
t
,
nil
)
logStore
.
Quit
()
})
}
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