mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-05-21 17:42:33 +02:00
New minerstats ready
This commit is contained in:
parent
4a78471ab9
commit
ccbfa24726
@ -1 +1 @@
|
|||||||
-host us-east.stratum.slushpool.com -port 3333 -user jstefanop.worker1 -brd_ocp 45 -osc 35 -fan_temp_hi 40 -fan_temp_low 60
|
-host us-east.stratum.slushpool.com -port 3333 -user jstefanop.worker1 -brd_ocp 50 -osc 46 -fan_temp_hi 50 -fan_temp_low 80
|
@ -4,12 +4,16 @@ module.exports.typeDefs = `
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MinerStatsOutput {
|
type MinerStatsOutput {
|
||||||
result: MinerStatsResult!
|
result: MinerStatsResult
|
||||||
error: Error
|
error: Error
|
||||||
}
|
}
|
||||||
|
|
||||||
type MinerStatsResult {
|
type MinerStatsResult {
|
||||||
date: Date
|
stats: MinerStats!
|
||||||
|
}
|
||||||
|
|
||||||
|
type MinerStats {
|
||||||
|
date: String
|
||||||
statVersion: String
|
statVersion: String
|
||||||
versions: MinerStatsVersion
|
versions: MinerStatsVersion
|
||||||
master: MinerStatsMaster
|
master: MinerStatsMaster
|
||||||
@ -83,9 +87,9 @@ module.exports.typeDefs = `
|
|||||||
sharesAccepted: Int
|
sharesAccepted: Int
|
||||||
sharesRejected: Int
|
sharesRejected: Int
|
||||||
solutionsAccepted: Int
|
solutionsAccepted: Int
|
||||||
minRespTime: Int
|
minRespTime: Float
|
||||||
avgRespTime: Int
|
avgRespTime: Float
|
||||||
maxRespTime: Int
|
maxRespTime: Float
|
||||||
shareLoss: Float
|
shareLoss: Float
|
||||||
poolTotal: Int
|
poolTotal: Int
|
||||||
inService: Int
|
inService: Int
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
const { join } = require('path')
|
const { join } = require('path')
|
||||||
const { exec } = require('child_process')
|
const { exec } = require('child_process')
|
||||||
const normalize = require('normalize-object')
|
|
||||||
const fs =require('fs');
|
const fs =require('fs');
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const _ = require('lodash')
|
||||||
|
|
||||||
module.exports = ({ define }) => {
|
module.exports = ({ define }) => {
|
||||||
define('stats', async (payload, { knex, errors, utils }) => {
|
define('stats', async (payload, { knex, errors, utils }) => {
|
||||||
@ -30,10 +30,23 @@ function getMinerStats (errors) {
|
|||||||
|
|
||||||
received = JSON.parse(received);
|
received = JSON.parse(received);
|
||||||
|
|
||||||
// Normalize object keys to fit GraphQL and be code-friendly
|
received.master.intervals = _.mapKeys(received.master.intervals, (value, name) => {
|
||||||
const results = normalize(received, 'camel');
|
return `int_${name}`
|
||||||
|
});
|
||||||
|
|
||||||
resolve(results)
|
received.pool.intervals = _.mapKeys(received.pool.intervals, (value, name) => {
|
||||||
|
return `int_${name}`
|
||||||
|
});
|
||||||
|
|
||||||
|
received.fans = _.mapKeys(received.fans, (value, name) => {
|
||||||
|
return `int_${name}`
|
||||||
|
});
|
||||||
|
|
||||||
|
received.slots = _.mapKeys(received.slots, (value, name) => {
|
||||||
|
return `int_${name}`
|
||||||
|
});
|
||||||
|
|
||||||
|
resolve(received)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
reject(new errors.InternalError(err.toString()));
|
reject(new errors.InternalError(err.toString()));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user