Open busheezy opened 8 years ago
@busheezy Which version of node are you running? Which method is failing? Can you provide an example of a server address which causes this failure?
var async = require('async');
var SourceQuery = require('sourcequery');
function updateServers(){
var servers = [
{
ip: 'duels3.joshog.com',
port: 27015
},
{
ip: 'duels2.joshog.com',
port: 27015
},
{
ip: 'duels1.joshog.com',
port: 27015
},
{
ip: 'surf1.joshog.com',
port: 27015
},
{
ip: 'surf2.joshog.com',
port: 27015
},
{
ip: 'mg.joshog.com',
port: 27015
},
{
ip: 'pistoldm.joshog.com',
port: 27015
},
{
ip: 'dm.joshog.com',
port: 27015
},
{
ip: 'bhop.joshog.com',
port: 27015
},
{
ip: 'retakes.joshog.com',
port: 27015
}
];
async.map(servers, getInfo, function (err, results){
console.log(results);
});
}
function getInfo(server, cb){
var sq = new SourceQuery(2000);
sq.open(server.ip, server.port);
async.series([
function (callback){
sq.getInfo(function (err, info){
server.info = info;
callback(null, 1);
});
},
function (callback){
sq.getPlayers(function (err, players){
server.players = players;
callback(null, 2);
});
},
function (callback){
sq.close(function(){
console.log('This does not seem to run but sq.close keeps it from never closing.');
});
callback(null, 3); // have to put down here to make sure it runs.
}
],
function(err, results){
cb(null, server);
}
);
}
setInterval(updateServers, 10 * 1000);
Here is a bit of the code I was using. You might want to wait until we are busier but it seemed to appear randomly. I was running node 5 and node 5.3. It would spit out those errors at me and lock up my site. I reduced it all the way down to the code above just for testing and it would still appear. The bug doesn't happen all of the time. I wasn't able to tell if a certain server was causing it.
This problem is isset yet. How to fix it?
I'm using a different library. I would suggest that you do the same. SourceQuery hasn't had an update in five years.
@busheezy Can you get link to that library?
This has been ruining my day for weeks.