FCM API allows a maximum of 1000 device tokens per send API. If more than 1000 device tokens are sent, it returns an invalid argument error and send request is not processed.

To send to more than 1000 devices, it has be to split into multiple batches. Below is example using Ruby FCM gem.

tokens = Device.where.not(push_token: [nil, '']).pluck('DISTINCT push_token')

fcm = FCM.new(server_key)
tokens.each_slice(1000) do |t|
  response = fcm.send(t, notification: notification, priority: priority)
  puts response
end