mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-02-14 17:49:59 +00:00
Fix webui
This commit is contained in:
@@ -43,7 +43,7 @@ function refresh () {
|
||||
// Compute instantaneous speed
|
||||
var s1 = series[i];
|
||||
var s2 = series[i+1];
|
||||
var speed = (s2.coins-s1.coins)/(s2.now-s1.now);
|
||||
var speed = (s2.hashes-s1.hashes)/(s2.now-s1.now);
|
||||
points.push({ x: s2.now, y: speed });
|
||||
}
|
||||
if (graph == null) {
|
||||
|
||||
@@ -6,29 +6,13 @@ app.get('/', function (req, res) {
|
||||
});
|
||||
|
||||
app.get('/json', function (req, res) {
|
||||
redis.lrange('timing', 0, -1, function (err, timing) {
|
||||
redis.hlen('wallet', function (err, coins) {
|
||||
timing.reverse();
|
||||
var speed10 = '?';
|
||||
var speed100 = '?';
|
||||
var speed1000 = '?';
|
||||
if (timing.length >= 10) {
|
||||
speed10 = 10 / (timing[0]-timing[9]);
|
||||
}
|
||||
if (timing.length >= 100) {
|
||||
speed100 = 100 / (timing[0]-timing[99]);
|
||||
}
|
||||
if (timing.length >= 1000) {
|
||||
speed1000 = 1000 / (timing[0]-timing[999]);
|
||||
}
|
||||
redis.hlen('wallet', function (err, coins) {
|
||||
redis.get('hashes', function (err, hashes) {
|
||||
var now = Date.now() / 1000;
|
||||
res.json( {
|
||||
speed10: speed10,
|
||||
speed100: speed100,
|
||||
speed1000: speed1000,
|
||||
coins: coins,
|
||||
now: now,
|
||||
ago: now - timing[0]
|
||||
hashes: hashes,
|
||||
now: now
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user