1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

linq optimization for android devices in push service

This commit is contained in:
Kyle Spearrin 2016-06-29 01:17:44 -04:00
parent ef0a808687
commit b16c0ca087

View File

@ -252,12 +252,12 @@ namespace Bit.Core.Services
}
// Android can send to many devices at once
if(_gcmBroker != null && devices.Any(d => d.Type == DeviceType.Android))
var androidDevices = devices.Where(d => d.Type == DeviceType.Android);
if(_gcmBroker != null && androidDevices.Count() > 0)
{
_gcmBroker.QueueNotification(new GcmNotification
{
RegistrationIds = devices.Where(d => d.Type == DeviceType.Android)
.Select(d => d.PushToken).ToList(),
RegistrationIds = androidDevices.Select(d => d.PushToken).ToList(),
Data = message
});
}