Mise à jour de GitLab prévue ce samedi 23 octobre 2021 à partir de 9h00 CET

Commit e713d60d authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] Compliance with duniter-ui

parent b46f6ae5
......@@ -309,7 +309,7 @@ export const CommonConstants = {
ARCHIVES_BLOCKS_CHUNK: 250,
SYNC_BLOCKS_CHUNK: 250,
CHUNK_PREFIX: 'chunk_',
BLOCKS_IN_MEMORY_MAX: 288 * 60, // 60 days of blocks
BLOCKS_IN_MEMORY_MAX: 288 * 60, // 288 = 1 day
MAX_AGE_OF_PEER_IN_BLOCKS: 200, // blocks
INITIAL_DOWNLOAD_SLOTS: 1, // 1 peer
......
......@@ -193,14 +193,6 @@ export class FileDAL {
}
}
public enableChangesAPI() {
this.lokiDaos.map(d => d.enableChangesAPI())
}
public disableChangesAPI() {
this.lokiDaos.map(d => d.disableChangesAPI())
}
async init(conf:ConfDTO) {
this.wotb = this.params.wotbf()
this.dals = [
......
......@@ -52,11 +52,7 @@ export const CrawlerDependency = {
synchronize: (server:Server, onHost:string, onPort:number, upTo:number, chunkLength:number) => {
const strategy = new RemoteSynchronizer(onHost, onPort, server, chunkLength)
const remote = new Synchroniser(server, strategy)
const syncPromise = (async () => {
await server.dal.disableChangesAPI()
await remote.sync(upTo, chunkLength)
await server.dal.enableChangesAPI()
})()
const syncPromise = remote.sync(upTo, chunkLength)
return {
flow: remote,
syncPromise
......
......@@ -73,7 +73,7 @@ export class GlobalIndexStream extends Duplex {
private wotbMem: WoTBInstance = WoTBObject.memoryInstance()
private mindexLokiInjection: Promise<void>
private memSyncInjection: Promise<void>
private currentChunkNumber = 0
private numberOfChunksToDownload:number
......@@ -99,7 +99,7 @@ export class GlobalIndexStream extends Duplex {
getAvailableForConditions: (conditions:string) => this.dal.sindexDAL.getAvailableForConditions(conditions)
}
this.mindexLokiInjection = (async () => {
this.memSyncInjection = (async () => {
await this.injectLoki(this.dal, 'dividendDAL', new LokiDividend(new loki())) // TODO
})()
}
......@@ -121,14 +121,14 @@ export class GlobalIndexStream extends Duplex {
(async () => {
await this.mindexLokiInjection
await this.memSyncInjection
if (!dataArray) {
return callback(null)
}
await this.transform(dataArray)
this.watcher.appliedPercent(Math.round(dataArray[0].block.number / 250 / this.numberOfChunksToDownload * 100))
this.watcher.appliedPercent(Math.round(dataArray[0].block.number / this.syncStrategy.chunkSize / this.numberOfChunksToDownload * 100))
callback(null)
})()
......@@ -333,7 +333,7 @@ export class GlobalIndexStream extends Duplex {
return block
}))
// We only keep approx 2 months of blocks in memory, so memory consumption keeps approximately constant during the sync
// We only keep a bunch of days of blocks in memory, so memory consumption keeps approximately constant during the sync
await this.dal.blockDAL.trimBlocks(blocks[blocks.length - 1].number - CommonConstants.BLOCKS_IN_MEMORY_MAX)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment