Ios SNS发送推送两次
我正在使用Ios SNS发送推送两次,ios,node.js,push-notification,amazon-sns,Ios,Node.js,Push Notification,Amazon Sns,我正在使用SNS向18000设备发送推送。但有时我在使用SNS时会收到两个通知 我使用NodeJS-AWS-SDK调用SNS.publish函数 ... getAlldevices(query, function(){ console.log(devices.length) # prints 18000 let sent = 0; devices.forEach(function(device){ SNSPUsh.send(message, devic
SNS
向18000
设备发送推送。但有时我在使用SNS
时会收到两个通知
我使用NodeJS-AWS-SDK
调用SNS.publish
函数
...
getAlldevices(query, function(){
console.log(devices.length) # prints 18000
let sent = 0;
devices.forEach(function(device){
SNSPUsh.send(message, device); # this function calls sns.publish
sent++;
console.log(sent);
});
console.log(sent++); # print 18000
});
在日志中,我看到了以下内容
18000
1
2
.
.
.
18000
18000
因此,日志/控制台中没有重复
但有时(并非每次)我会得到两次推送,我检查了CloudWatch NumberOfMessagesPublished
,结果显示它发布了36000
。我没有发布到主题,因此没有重试策略
我正在使用此可能是事件发布者的问题,您的发布者可能会发布两次