MoneroOcean / nodejs-pool

Official repository of MoneroOcean (XMR) mining pool
https://moneroocean.stream
Other
115 stars 71 forks source link

global.database.getCache('pool_stats_pps') return false, do I miss something in db pool.config ? #51

Open longnight opened 6 years ago

longnight commented 6 years ago

Hi, after first run deploy.sh , those API:

keep telling:

TypeError: Cannot create property 'fee' on boolean 'false'
   at /home/username/nodejs-pool/lib/api.js:248:28
   at Layer.handle [as handle_request] (/home/username/nodejs-pool/node_modules/express/lib/router/layer.js:95:5)
   at next (/home/username/nodejs-pool/node_modules/express/lib/router/route.js:131:13)
   at makeResponseCacheable (/home/username/nodejs-pool/node_modules/apicache/src/apicache.js:207:5)
   at cache (/home/username/nodejs-pool/node_modules/apicache/src/apicache.js:438:16)
   at Layer.handle [as handle_request] (/home/username/nodejs-pool/node_modules/express/lib/router/layer.js:95:5)
   at next (/home/username/nodejs-pool/node_modules/express/lib/router/route.js:131:13)
   at Route.dispatch (/home/username/nodejs-pool/node_modules/express/lib/router/route.js:112:3)
   at Layer.handle [as handle_request] (/home/username/nodejs-pool/node_modules/express/lib/router/layer.js:95:5)
   at /home/username/nodejs-pool/node_modules/express/lib/router/index.js:277:22
   at param (/home/username/nodejs-pool/node_modules/express/lib/router/index.js:349:14)
   at param (/home/username/nodejs-pool/node_modules/express/lib/router/index.js:365:14)
   at Function.process_params (/home/username/nodejs-pool/node_modules/express/lib/router/index.js:410:3)
   at next (/home/username/nodejs-pool/node_modules/express/lib/router/index.js:271:10)
   at jsonParser (/home/username/nodejs-pool/node_modules/body-parser/lib/types/json.js:110:7)
   at Layer.handle [as handle_request] (/home/username/nodejs-pool/node_modules/express/lib/router/layer.js:95:5)

I've check the code, it seen not get the db cache on /api.js line 248,

global.database.getCache('pool_stats_pplns')

which returns a false value. Do I miss some configs value in database pool.config or config.json something ? And, API /leafApi also return a 502 Bad Gateway.

Thanks for help.

MoneroOcean commented 6 years ago

Try to restart api module. This happens during initial pool run. Also see https://github.com/Snipa22/nodejs-pool/pull/280

longnight commented 6 years ago

I've restart api several times and errors appear as the same. I wonder may be some config value lost. @MoneroOcean

1rV1N-git commented 6 years ago

@longnight enable PPS restart worker module then wait 1 min.

1rV1N-git commented 6 years ago

or add in worker module

if (!(global.database.getCache('pool_stats_pps'))){
    global.database.setCache('pool_stats_pps', {
            hashRate: 0,
            miners: 0,
            totalHashes: 0,
            lastBlockFoundTime: 0,
            lastBlockFound:  0,
            totalBlocksFound:  0,
            totalMinersPaid: 0,
            totalPayments: 0,
            roundHashes: 0,
        totalAltBlocksFound:  0,
        altBlocksFound: {},
            activePort:  0,
            activePortProfit:  0,
            activePortComment: "",
            minBlockRewards: {}
        });
}
longnight commented 6 years ago

@1rV1N-git Thank you.

What should do to enable PPS ? I've already modified some config in db pool.config. And, I appended above code in to worker module, /api/pool/stats/pps no more complaint, but /api/pool/stats/pplns /api/pool/stats/solo /leafApi are still giving me 500 error