mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-23 14:32:30 +00:00
Merge pull request #86 from dignifiedquire/fix-bench
fix benchmark example
This commit is contained in:
commit
1a1029fc84
@ -46,13 +46,13 @@ let store;
|
|||||||
const queryLoop = (db) => {
|
const queryLoop = (db) => {
|
||||||
// let timer = new Timer();
|
// let timer = new Timer();
|
||||||
// timer.start();
|
// timer.start();
|
||||||
store.add(username + totalQueries).then(() => {
|
db.add(username + totalQueries).then(() => {
|
||||||
// console.log(`${timer.stop(true)} ms - ${process._getActiveRequests().length} ${process._getActiveHandles().length}`);
|
// console.log(`${timer.stop(true)} ms - ${process._getActiveRequests().length} ${process._getActiveHandles().length}`);
|
||||||
// console.log(util.inspect(process.memoryUsage()));
|
// console.log(util.inspect(process.memoryUsage()));
|
||||||
totalQueries ++;
|
totalQueries ++;
|
||||||
lastTenSeconds ++;
|
lastTenSeconds ++;
|
||||||
queriesPerSecond ++;
|
queriesPerSecond ++;
|
||||||
process.nextTick(queryLoop);
|
process.nextTick(() => queryLoop(db));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -61,18 +61,11 @@ let run = (() => {
|
|||||||
console.log(`Connecting...`)
|
console.log(`Connecting...`)
|
||||||
startIpfs()
|
startIpfs()
|
||||||
.then((ipfs) => OrbitDB.connect(network, username, password, ipfs))
|
.then((ipfs) => OrbitDB.connect(network, username, password, ipfs))
|
||||||
.then((orbit) => {
|
|
||||||
console.log("OrbitDB")
|
|
||||||
orbit.events.on('load', () => console.log("loading log"))
|
|
||||||
orbit.events.on('ready', (db) => {
|
|
||||||
console.log("log fetched from history for", db.dbname);
|
|
||||||
store = db;
|
|
||||||
queryLoop();
|
|
||||||
});
|
|
||||||
return orbit;
|
|
||||||
})
|
|
||||||
.then((orbit) => orbit.eventlog(channelName))
|
.then((orbit) => orbit.eventlog(channelName))
|
||||||
.then(() => {
|
.then((db) => {
|
||||||
|
|
||||||
|
queryLoop(db);
|
||||||
|
|
||||||
// Metrics output
|
// Metrics output
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
seconds ++;
|
seconds ++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user