MaxListenersExceededWarning - 环回

Pho*_*Dev 5 memory-leaks node.js loopbackjs node-apn node-gcm

我收到以下错误:

 (node:18591) MaxListenersExceededWarning: Possible EventEmitter memory 
leak detected. 11 wakeup listeners added. Use emitter.setMaxListeners() to increase limit.
Run Code Online (Sandbox Code Playgroud)

在执行发送推送通知的脚本之后。我正在使用“node-gcm”和“apn”npm 模块分别发送android 和ios 推送通知。我用于发送通知的代码是:

安卓:

async.each(tokenBatches, function (batch) {
// Assuming you already set up the sender and message
   sender.send(message, {registrationIds: batch}, function (err, result) {
    // Push failed?
    if (err) {
    // Stops executing other batches
        console.log(err);
    }
    console.log(result);
    });
});
Run Code Online (Sandbox Code Playgroud)

在这里,设备令牌作为一批 1000 个令牌传递。

IOS:

provider.send(notification, iosTokens).then((response) => {
   console.log(response);
});
Run Code Online (Sandbox Code Playgroud)

在这里,所有令牌都在 iosTokens 数组中发送。这两个脚本并行运行。这段代码可能有什么问题?我看到一些解决方案要求设置最大侦听器,但我没有做对。有什么办法可以修复内存泄漏错误。任何帮助,将不胜感激!提前致谢。