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
e1fe75e3
Commit
e1fe75e3
authored
May 27, 2015
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/utils: use constant for import batch size
parent
a8bc2181
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
cmd.go
cmd/utils/cmd.go
+6
-3
No files found.
cmd/utils/cmd.go
View file @
e1fe75e3
...
@@ -40,6 +40,10 @@ import (
...
@@ -40,6 +40,10 @@ import (
"github.com/peterh/liner"
"github.com/peterh/liner"
)
)
const
(
importBatchSize
=
2500
)
var
interruptCallbacks
=
[]
func
(
os
.
Signal
){}
var
interruptCallbacks
=
[]
func
(
os
.
Signal
){}
// Register interrupt handlers callbacks
// Register interrupt handlers callbacks
...
@@ -205,8 +209,7 @@ func ImportChain(chain *core.ChainManager, fn string) error {
...
@@ -205,8 +209,7 @@ func ImportChain(chain *core.ChainManager, fn string) error {
stream
:=
rlp
.
NewStream
(
fh
,
0
)
stream
:=
rlp
.
NewStream
(
fh
,
0
)
// Run actual the import.
// Run actual the import.
batchSize
:=
2500
blocks
:=
make
(
types
.
Blocks
,
importBatchSize
)
blocks
:=
make
(
types
.
Blocks
,
batchSize
)
n
:=
0
n
:=
0
for
batch
:=
0
;
;
batch
++
{
for
batch
:=
0
;
;
batch
++
{
// Load a batch of RLP blocks.
// Load a batch of RLP blocks.
...
@@ -214,7 +217,7 @@ func ImportChain(chain *core.ChainManager, fn string) error {
...
@@ -214,7 +217,7 @@ func ImportChain(chain *core.ChainManager, fn string) error {
return
fmt
.
Errorf
(
"interrupted"
)
return
fmt
.
Errorf
(
"interrupted"
)
}
}
i
:=
0
i
:=
0
for
;
i
<
b
atchSize
;
i
++
{
for
;
i
<
importB
atchSize
;
i
++
{
var
b
types
.
Block
var
b
types
.
Block
if
err
:=
stream
.
Decode
(
&
b
);
err
==
io
.
EOF
{
if
err
:=
stream
.
Decode
(
&
b
);
err
==
io
.
EOF
{
break
break
...
...
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