Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
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
nodes
typescript
duniter
Commits
35109262
Commit
35109262
authored
7 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
[fix] CLI test was skept
parent
8f81972b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/modules/crawler/lib/sync.ts
+8
-4
8 additions, 4 deletions
app/modules/crawler/lib/sync.ts
test/integration/cli.js
+1
-2
1 addition, 2 deletions
test/integration/cli.js
with
9 additions
and
6 deletions
app/modules/crawler/lib/sync.ts
+
8
−
4
View file @
35109262
...
...
@@ -206,7 +206,7 @@ export class Synchroniser extends stream.Duplex {
// We use cautious mode if it is asked, or not particulary asked but blockchain has been started
const
cautious
=
(
askedCautious
===
true
||
localNumber
>=
0
);
const
shuffledPeers
=
noShufflePeers
?
peers
:
_
.
shuffle
(
peers
);
const
downloader
=
new
P2PDownloader
(
rCurrent
.
currency
,
localNumber
,
to
,
rCurrent
.
hash
,
shuffledPeers
,
this
.
watcher
,
this
.
logger
,
hashf
,
this
.
dal
,
this
.
slowOption
,
this
.
otherDAL
);
const
downloader
=
new
P2PDownloader
(
rCurrent
.
currency
,
localNumber
,
to
,
rCurrent
.
hash
,
shuffledPeers
,
this
.
watcher
,
this
.
logger
,
hashf
,
this
.
dal
,
this
.
slowOption
,
!
cautious
,
this
.
otherDAL
);
downloader
.
start
();
...
...
@@ -678,6 +678,7 @@ class P2PDownloader {
private
hashf
:
any
,
private
dal
:
FileDAL
,
private
slowOption
:
any
,
private
nocautious
:
boolean
,
private
otherDAL
?:
FileDAL
)
{
this
.
TOO_LONG_TIME_DOWNLOAD
=
"
No answer after
"
+
this
.
MAX_DELAY_PER_DOWNLOAD
+
"
ms, will retry download later.
"
;
...
...
@@ -756,9 +757,12 @@ class P2PDownloader {
// Chunk is COMPLETE
this
.
logger
.
warn
(
"
Chunk #%s is COMPLETE from %s
"
,
realIndex
,
[
this
.
handler
[
realIndex
].
host
,
this
.
handler
[
realIndex
].
port
].
join
(
'
:
'
));
this
.
chunks
[
realIndex
]
=
blocks
;
// We pre-save blocks only for non-cautious sync
if
(
this
.
nocautious
)
{
await
this
.
dal
.
blockDAL
.
insertBatch
(
blocks
.
map
((
b
:
any
)
=>
BlockDTO
.
fromJSONObject
(
b
)))
this
.
writtenChunks
++
watcher
.
savedPercent
(
Math
.
round
(
this
.
writtenChunks
/
this
.
numberOfChunksToDownload
*
100
));
}
this
.
resultsDeferers
[
realIndex
].
resolve
(
this
.
chunks
[
realIndex
]);
}
else
{
this
.
logger
.
warn
(
"
Chunk #%s DOES NOT CHAIN CORRECTLY from %s
"
,
realIndex
,
[
this
.
handler
[
realIndex
].
host
,
this
.
handler
[
realIndex
].
port
].
join
(
'
:
'
));
...
...
This diff is collapsed.
Click to expand it.
test/integration/cli.js
+
1
−
2
View file @
35109262
...
...
@@ -22,12 +22,11 @@ const toolbox = require('./tools/toolbox');
const
duniter
=
require
(
'
../../index
'
);
const
merkleh
=
require
(
'
../../app/lib/helpers/merkle
'
);
const
hashf
=
require
(
'
../../app/lib/common-libs
'
).
hashf
const
constants
=
require
(
'
../../app/lib/constants
'
);
const
MerkleDTO
=
require
(
'
../../app/lib/dto/MerkleDTO
'
).
MerkleDTO
const
DB_NAME
=
"
unit_tests
"
;
describe
.
skip
(
"
CLI
"
,
function
()
{
describe
(
"
CLI
"
,
function
()
{
let
farmOfServers
=
[],
fakeServer
;
...
...
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