Open source toolkit for voice services; with special focus to the needs of medium- and low-income countries, scalable services, and interacting with vulnerable populations
When queueing calls with a specific call flow from the Projects page, we first check we don't call the same Contact twice (ie, if the user pasted two different phones of the same contact at the same time).
If the project's address book grew large, the method is really slow when mapping contact addresses to contacts, because it loads every contact address for the project from the database - and iterating over them. We've seen this method take ~20 seconds with ~365k contacts in a production environment.
This PR changes the method so it only works with the Contacts of the given phone numbers instead of every contact of the project. We now do two queries to the DB instead of a single one, but we query via an index, and significantly reduce the amount of records to work with.
When queueing calls with a specific call flow from the Projects page, we first check we don't call the same Contact twice (ie, if the user pasted two different phones of the same contact at the same time).
If the project's address book grew large, the method is really slow when mapping contact addresses to contacts, because it loads every contact address for the project from the database - and iterating over them. We've seen this method take ~20 seconds with ~365k contacts in a production environment.
This PR changes the method so it only works with the Contacts of the given phone numbers instead of every contact of the project. We now do two queries to the DB instead of a single one, but we query via an index, and significantly reduce the amount of records to work with.
See #944