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
2bb8f811
Commit
2bb8f811
authored
6 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
[fix] sync: FS sync failed when source and target archives where not the same
parent
2b1cf691
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/modules/crawler/lib/sync/ChunkGetter.ts
+10
-7
10 additions, 7 deletions
app/modules/crawler/lib/sync/ChunkGetter.ts
with
10 additions
and
7 deletions
app/modules/crawler/lib/sync/ChunkGetter.ts
+
10
−
7
View file @
2bb8f811
...
...
@@ -165,15 +165,18 @@ export class ChunkGetter {
handler
.
downloader
=
this
.
p2PDownloader
// If ever the first call does not chains well, we try using P2P
;(
handler
as
any
).
state
=
'
WAITING
'
i
++
}
else
if
(
handler
.
downloader
!==
this
.
fsDownloader
)
{
// Store the file to avoid re-downloading
if
(
this
.
localNumber
<=
0
&&
chunk
.
length
===
CommonConstants
.
CONST_BLOCKS_CHUNK
)
{
await
this
.
writeDAL
.
confDAL
.
coreFS
.
makeTree
(
this
.
syncStrategy
.
getCurrency
())
const
content
=
{
blocks
:
chunk
.
map
((
b
:
any
)
=>
DBBlock
.
fromBlockDTO
(
b
))
}
await
this
.
writeDAL
.
confDAL
.
coreFS
.
writeJSON
(
fileName
,
content
)
}
}
else
{
logger
.
warn
(
"
Chunk #%s read from filesystem.
"
,
i
)
let
doWrite
=
handler
.
downloader
!==
this
.
fsDownloader
||
!
(
await
this
.
writeDAL
.
confDAL
.
coreFS
.
exists
(
fileName
))
if
(
doWrite
)
{
// Store the file to avoid re-downloading
if
(
this
.
localNumber
<=
0
&&
chunk
.
length
===
CommonConstants
.
CONST_BLOCKS_CHUNK
)
{
await
this
.
writeDAL
.
confDAL
.
coreFS
.
makeTree
(
this
.
syncStrategy
.
getCurrency
())
const
content
=
{
blocks
:
chunk
.
map
((
b
:
any
)
=>
DBBlock
.
fromBlockDTO
(
b
))
}
await
this
.
writeDAL
.
confDAL
.
coreFS
.
writeJSON
(
fileName
,
content
)
}
}
}
if
(
chainsWell
)
{
...
...
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