mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-27 08:22:31 +00:00
Cleanup
This commit is contained in:
parent
7f34829645
commit
471b189cbb
@ -5,8 +5,7 @@ var OrbitClient = require('../src/OrbitClient');
|
||||
var Timer = require('./Timer');
|
||||
|
||||
// orbit-server
|
||||
// const host = 'localhost';
|
||||
const host = '178.62.241.75';
|
||||
const host = 'localhost';
|
||||
const port = 3333;
|
||||
|
||||
var username = 'testrunner';
|
||||
@ -17,8 +16,8 @@ let run = (async(() => {
|
||||
// Connect
|
||||
var orbit = OrbitClient.connect(host, port, username, password);
|
||||
|
||||
const id = process.argv[2] ? process.argv[2] : 'a';
|
||||
const channelName = 'c1';
|
||||
const id = process.argv[3] ? process.argv[3] : 'a';
|
||||
const channelName = process.argv[2] ? process.argv[2] : 'c1';
|
||||
const db = orbit.channel(channelName);
|
||||
|
||||
// Metrics
|
||||
|
@ -23,14 +23,14 @@ let run = (async(() => {
|
||||
while(true) {
|
||||
const key = process.argv[4] ? process.argv[4] : 'greeting';
|
||||
const value = process.argv[5] ? process.argv[5] : 'Hello world';
|
||||
let timer = new Timer(true);
|
||||
const timer = new Timer(true);
|
||||
db.put(key, value + " " + count);
|
||||
let v = db.get(key);
|
||||
const result = db.get(key);
|
||||
|
||||
console.log("---------------------------------------------------")
|
||||
console.log("Key | Value")
|
||||
console.log("---------------------------------------------------")
|
||||
console.log(`${key} | ${v}`);
|
||||
console.log(`${key} | ${result}`);
|
||||
console.log("---------------------------------------------------")
|
||||
console.log(`Query #${count} took ${timer.stop(true)} ms\n`);
|
||||
|
||||
|
@ -23,12 +23,12 @@ let run = (async(() => {
|
||||
setInterval(async(() => {
|
||||
const key = process.argv[4] ? process.argv[4] : 'greeting';
|
||||
let timer = new Timer(true);
|
||||
let v = db.get(key);
|
||||
const result = db.get(key);
|
||||
|
||||
console.log("---------------------------------------------------")
|
||||
console.log("Key | Value")
|
||||
console.log("---------------------------------------------------")
|
||||
console.log(`${key} | ${v}`);
|
||||
console.log(`${key} | ${result}`);
|
||||
console.log("---------------------------------------------------")
|
||||
console.log(`Query #${count} took ${timer.stop(true)} ms\n`);
|
||||
|
||||
|
@ -27,7 +27,7 @@ class OrbitClient {
|
||||
channel(hash, password) {
|
||||
if(password === undefined) password = '';
|
||||
|
||||
const processMsg = async((hash, message) => {
|
||||
const onMessage = async((hash, message) => {
|
||||
const other = await(List.fromIpfsHash(this._ipfs, message));
|
||||
if(other.id !== this.user.username) {
|
||||
this._store.join(other);
|
||||
@ -42,7 +42,7 @@ class OrbitClient {
|
||||
}
|
||||
});
|
||||
|
||||
this._pubsub.subscribe(hash, password, processMsg, onLatest);
|
||||
this._pubsub.subscribe(hash, password, onMessage, onLatest);
|
||||
|
||||
return {
|
||||
iterator: (options) => this._iterator(hash, password, options),
|
||||
|
Loading…
x
Reference in New Issue
Block a user