forked from GitHub/dbot
put eachseries in process.nextTick
This commit is contained in:
parent
ac8783dbd6
commit
dfaa795b8f
@ -196,23 +196,25 @@ var users = function(dbot) {
|
|||||||
dbot.instance.addListener('366', 'users', function(event) {
|
dbot.instance.addListener('366', 'users', function(event) {
|
||||||
var checkChannel = function(channel) {
|
var checkChannel = function(channel) {
|
||||||
async.eachSeries(_.keys(event.channel.nicks), function(nick, next) {
|
async.eachSeries(_.keys(event.channel.nicks), function(nick, next) {
|
||||||
var staff = event.channel.nicks[nick];
|
process.nextTick(function() {
|
||||||
|
var staff = event.channel.nicks[nick];
|
||||||
|
|
||||||
this.api.resolveUser(event.server, nick, function(user) {
|
this.api.resolveUser(event.server, nick, function(user) {
|
||||||
var checkChannelUser = function(user) {
|
var checkChannelUser = function(user) {
|
||||||
if(!_.include(channel.users, user.id)) {
|
if(!_.include(channel.users, user.id)) {
|
||||||
this.internalAPI.addChannelUser(channel, user, staff, next);
|
this.internalAPI.addChannelUser(channel, user, staff, next);
|
||||||
|
} else {
|
||||||
|
this.internalAPI.modChannelStaff(channel, user, staff, next);
|
||||||
|
}
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
|
if(user) {
|
||||||
|
checkChannelUser(user);
|
||||||
} else {
|
} else {
|
||||||
this.internalAPI.modChannelStaff(channel, user, staff, next);
|
this.internalAPI.createUser(event.server, nick, checkChannelUser);
|
||||||
}
|
}
|
||||||
}.bind(this);
|
}.bind(this));
|
||||||
|
});
|
||||||
if(user) {
|
|
||||||
checkChannelUser(user);
|
|
||||||
} else {
|
|
||||||
this.internalAPI.createUser(event.server, nick, checkChannelUser);
|
|
||||||
}
|
|
||||||
}.bind(this));
|
|
||||||
}.bind(this), function(err) {
|
}.bind(this), function(err) {
|
||||||
console.log('finished checking ' + channel);
|
console.log('finished checking ' + channel);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user