의 배열을 채우고 있지만 나는 그것의 항상 empty.I 밀고하고 데이터를 다시 호출에 비동기 루프에서 두 시간을 얻을 때. retMessages는 messages_filtered에서 만들어 지지만 비어 있으므로 retMessages는 항상 비어 있습니다.배열 푸시 지금은 messages_filtered 배열의 데이터를 밀어하고 Node.js를
Service.poll = function(user, callback) {
var messages_filtered = [];
async.forEach(activeAccountsFor(user), function(acct, done) {
graph.setAccessToken(acct.accessToken);
var connections = ['feed', 'links', 'tagged', 'posts', 'notes', 'inbox', 'outbox'];
var args = acct.updated_time ? {since: acct.updated_time - 3000} : {};
args['date_format']= 'U';
User.markAsUpdated(user._id);
User.markAccountAsUpdated(user._id, acct.userID);
async.forEach(connections, function(connection, next) {
graph.setOptions(options).get('me/' + connection, args,
function(err, feed) {
if (err) {
winston.log('error', 'Error in connection ');
return done();
}
async.forEach(feed.data, function(datum, onward) {
profanity_service.analyzeFeedItem(datum, function(err, result) {
if(!_.isUndefined(datum.comments)){
if(!_.isUndefined(datum.comments.data) && !_.isEmpty(datum.comments.data)){
_.each(datum.comments.data, function(data){
if(moment(data.created_time).unix() >= user.updated_time){
profanity_service.analyzeFeedItem(data, function(err, result) {
if(!err && result){
if (result.isProfane){
messages_filtered.push(result);
}
}
});
}
});
}
}
if(!err && result){
if (result.isProfane) {
messages_filtered.push(result);
}
}
onward(err);
});
}, next);
});
}, done);
}, function(err) {
console.log('messages_filtered.length ' + messages_filtered.length);
if (messages_filtered.length > 0) {
var retMessages = [];
_.each(messages_filtered, function(message) {
if (!hasMessage(retMessages, message)) {
retMessages.push(message)
Message.flag(user._id, message);
}
});
user.notify(retMessages);
}
callback(err);
});
};
멋진 크리스마스 트리가 있습니다. P – PeeHaa