Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
张蕾
Geth-Modification
Commits
6f13e515
Unverified
Commit
6f13e515
authored
Mar 02, 2018
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/faucet: update state in background, skip when busy
parent
a76e46e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
faucet.go
cmd/faucet/faucet.go
+16
-3
No files found.
cmd/faucet/faucet.go
View file @
6f13e515
...
...
@@ -533,9 +533,11 @@ func (f *faucet) loop() {
}
defer
sub
.
Unsubscribe
()
for
{
select
{
case
head
:=
<-
heads
:
// Start a goroutine to update the state from head notifications in the background
update
:=
make
(
chan
*
types
.
Header
)
go
func
()
{
for
head
:=
range
update
{
// New chain head arrived, query the current stats and stream to clients
var
(
balance
*
big
.
Int
...
...
@@ -588,6 +590,17 @@ func (f *faucet) loop() {
}
}
f
.
lock
.
RUnlock
()
}
}()
// Wait for various events and assing to the appropriate background threads
for
{
select
{
case
head
:=
<-
heads
:
// New head arrived, send if for state update if there's none running
select
{
case
update
<-
head
:
default
:
}
case
<-
f
.
update
:
// Pending requests updated, stream to clients
...
...
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