mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-12 11:08:10 +08:00
0644d2663d
Summary: Because of JavaScript's asynchronous nature, it is possible that we will be processing several downloaded messages concurrently. This can lead to calling extractContacts() in an interleaved fashion, which it was not designed to handle. It looks up which contacts are already in the database and then performs inserts or updates accordingly, assuming nothing has changed in the contacts table in between---which is not true! If several messages have similar contacts, an insert race can cause one of the inserts to throw an unhandled exception. We fix this by simply catching the unique constraint error, and falling back to an update instead. (There's not really a better way to deal with write races other than to enforce that we process contacts from messages serially, as transactions are of no help here.) This commit also removes extractContacts()'s return value, which is not currently used and I found confusing. Test Plan: manual Reviewers: juan, evan, mark, jackie Reviewed By: jackie Differential Revision: https://phab.nylas.com/D3555 |
||
---|---|---|
.. | ||
images | ||
spec | ||
src | ||
stylesheets | ||
main.es6 | ||
package.json |