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
dfaed99e
Commit
dfaed99e
authored
9 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
Fix
#226
bad algorithm for memory cleaning of blocks
parent
aed46783
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/lib/constants.js
+2
-1
2 additions, 1 deletion
app/lib/constants.js
app/lib/dal/fileDALs/BlockDAL.js
+30
-33
30 additions, 33 deletions
app/lib/dal/fileDALs/BlockDAL.js
server.js
+3
-0
3 additions, 0 deletions
server.js
with
35 additions
and
34 deletions
app/lib/constants.js
+
2
−
1
View file @
dfaed99e
...
...
@@ -164,7 +164,8 @@ module.exports = {
INVALIDATE_CORE_CACHE
:
true
,
WITH_SIGNATURES_AND_POW
:
true
,
SAFE_FACTOR
:
1.5
,
MEMORY_CLEAN_INTERVAL
:
60
*
60
,
// hourly
SAFE_FACTOR
:
3
,
BLOCKS_COLLECT_THRESHOLD
:
30
,
// Blocks to collect from memory and persist
setUDID2Format
:
function
()
{
...
...
This diff is collapsed.
Click to expand it.
app/lib/dal/fileDALs/BlockDAL.js
+
30
−
33
View file @
dfaed99e
...
...
@@ -86,7 +86,6 @@ function BlockDAL(loki, rootFS, getLowerWindowBlock) {
}
return
co
(
function
*
()
{
let
filesBlocks
=
yield
Q
.
all
(
_
.
range
(
start
,
Math
.
min
(
lowerInLoki
.
number
,
end
+
1
)).
map
((
number
)
=>
rootFS
.
readJSON
(
pathOfBlock
(
number
)
+
blockFileName
(
number
)
+
'
.json
'
)));
yield
migrateOldBlocks
();
return
filesBlocks
.
concat
(
lokiBlocks
);
});
};
...
...
@@ -184,8 +183,7 @@ function BlockDAL(loki, rootFS, getLowerWindowBlock) {
current
=
previousBlock
;
};
function
migrateOldBlocks
()
{
return
co
(
function
*
()
{
this
.
migrateOldBlocks
=
()
=>
co
(
function
*
()
{
let
number
=
yield
getLowerWindowBlock
();
logger
.
debug
(
"
Clean some blocks from memory to disk...
"
);
logger
.
debug
(
"
Lower block = %s
"
,
number
);
...
...
@@ -217,7 +215,6 @@ function BlockDAL(loki, rootFS, getLowerWindowBlock) {
logger
.
debug
(
"
LastUD in loki = %s
"
,
that
.
lastBlockWithDividend
().
number
);
}
});
}
function
getView
()
{
let
view
;
...
...
This diff is collapsed.
Click to expand it.
server.js
+
3
−
0
View file @
dfaed99e
...
...
@@ -167,6 +167,9 @@ function Server (dbConf, overrideConf) {
},
function
(
next
){
that
.
PeeringService
.
regularSyncBlock
(
next
);
},
function
(
next
){
that
.
BlockchainService
.
regularCleanMemory
(
next
);
}
],
done
);
};
...
...
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