Currently push messages are sent one by one even if there are many workers configured in the pool.
It might not be a good idea to just wrap APNS.push/2 in Task.async/1 but having this as a separate function would make it clearer that this is a choice the consumer can do.
An even fancier version of this would be to have a push_many function that process tokens in chunks and runs x push-calls in parallel but so that there is a cap on how many processes is spawned.
pseudo example:
Enum.chunk(tokens, 100, fn (chunk) ->
jobs = for token <- chunk do
Task.async(fn->
APNS.push(pool, message)
end)
await_many(jobs)
end
end)
Currently push messages are sent one by one even if there are many workers configured in the pool.
It might not be a good idea to just wrap
APNS.push/2
inTask.async/1
but having this as a separate function would make it clearer that this is a choice the consumer can do.An even fancier version of this would be to have a
push_many
function that process tokens in chunks and runs x push-calls in parallel but so that there is a cap on how many processes is spawned.pseudo example: