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

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

[fix] sync: was long within duniter-ui

parent 5517bdad
......@@ -36,7 +36,8 @@ export class LokiProxyCollection<T> implements LokiCollection<T> {
return this.collection.chain()
}
setDisableChangesAPI(disable: boolean) {
this.collection.setDisableChangesAPI(disable)
setChangesApi(enabled: boolean) {
this.collection.setChangesApi(enabled)
;(this.collection as any).disableDeltaChangesApi = true
}
}
......@@ -29,11 +29,11 @@ export abstract class LokiCollectionManager<T> implements LokiDAO {
}
public enableChangesAPI() {
this.collection.setDisableChangesAPI(false)
this.collection.setChangesApi(true)
}
public disableChangesAPI() {
this.collection.setDisableChangesAPI(true)
this.collection.setChangesApi(false)
}
async init(): Promise<void> {
......
......@@ -13,7 +13,7 @@ export interface LokiCollection<T> {
chain(): LokiChainableFind<T>
setDisableChangesAPI(disable: boolean): void
setChangesApi(disable: boolean): void
}
export interface LokiChainableFind<T> {
......
......@@ -51,14 +51,14 @@ export const CrawlerDependency = {
synchronize: (server:Server, onHost:string, onPort:number, upTo:number, chunkLength:number) => {
const strategy = new RemoteSynchronizer(onHost, onPort, server)
const remote = new Synchroniser(server, strategy)
const syncPromise = remote.sync(upTo, chunkLength)
const syncPromise = (async () => {
await server.dal.disableChangesAPI()
await remote.sync(upTo, chunkLength)
await server.dal.enableChangesAPI()
})()
return {
flow: remote,
syncPromise: (async () => {
await server.dal.disableChangesAPI()
await syncPromise
await server.dal.enableChangesAPI()
})()
syncPromise
};
},
......@@ -91,7 +91,7 @@ export const CrawlerDependency = {
name: 'sync [source] [to]',
desc: 'Synchronize blockchain from a remote Duniter node',
preventIfRunning: true,
onDatabaseExecute: async (server:Server, conf:ConfDTO, program:any, params:any) => {
onDatabaseExecute: async (server:Server, conf:ConfDTO, program:any, params:any): Promise<any> => {
const source = params[0]
const to = params[1]
const HOST_PATTERN = /^[^:/]+(:[0-9]{1,5})?$/
......
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