2016-02-21 17:52:20 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var async = require('asyncawait/async');
|
|
|
|
var await = require('asyncawait/await');
|
|
|
|
var OrbitClient = require('../src/OrbitClient');
|
|
|
|
var Timer = require('./Timer');
|
|
|
|
|
|
|
|
// var host = '178.62.229.175';
|
|
|
|
var host = 'localhost';
|
|
|
|
var port = 6379;
|
|
|
|
|
|
|
|
var username = 'LambOfGod';
|
|
|
|
var password = '';
|
|
|
|
|
|
|
|
let run = (async(() => {
|
|
|
|
try {
|
|
|
|
var orbit = OrbitClient.connect(host, port, username, password);
|
|
|
|
const c1 = 'c1';
|
|
|
|
const channel = orbit.channel(c1);
|
|
|
|
|
|
|
|
let count = 1;
|
|
|
|
let id = 'Log: Query '
|
|
|
|
let running = false;
|
|
|
|
|
2016-02-22 11:33:38 +02:00
|
|
|
// setInterval(async(() => {
|
|
|
|
// if(!running) {
|
|
|
|
while(true) {
|
2016-02-21 17:52:20 +02:00
|
|
|
running = true;
|
|
|
|
|
2016-02-22 11:33:38 +02:00
|
|
|
const key = "Lamb";
|
|
|
|
let timer = new Timer(true);
|
|
|
|
channel.put(key, "Of God " + count);
|
|
|
|
let v = channel.get(key);
|
|
|
|
console.log(`Query #${count} took ${timer.stop(true)} ms\n`);
|
2016-02-21 17:52:20 +02:00
|
|
|
|
|
|
|
console.log("---------------------------------------------------")
|
2016-02-22 11:33:38 +02:00
|
|
|
console.log("Key | Value")
|
2016-02-21 17:52:20 +02:00
|
|
|
console.log("---------------------------------------------------")
|
2016-02-22 11:33:38 +02:00
|
|
|
console.log(`${key} | ${v}`);
|
2016-02-21 17:52:20 +02:00
|
|
|
console.log("---------------------------------------------------")
|
|
|
|
|
|
|
|
running = false;
|
|
|
|
count ++;
|
2016-02-22 11:33:38 +02:00
|
|
|
}
|
|
|
|
// }
|
|
|
|
// }), 500);
|
2016-02-21 17:52:20 +02:00
|
|
|
|
|
|
|
} catch(e) {
|
|
|
|
console.error("error:", e);
|
|
|
|
console.error(e.stack);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
}))();
|
|
|
|
|
|
|
|
module.exports = run;
|