Mailspring/packages/client-sync
Christine Spang 84a3b20839 [client-sync] Refresh SMTP client when auth credentials change
Summary:
Previously, we would create a nodemailer SMTP transport object when the
sync worker booted up. The transport object would be passed the account
SMTP credentials at the time of object creation. If the Google auth
token later expired, we would continue to try to send mail using the
expired token, resulting in "Invalid login" failures.

This patch makes it so we refresh the transport object if the auth token
changes, and also turns on SMTP connection pooling to limit simultaneous
SMTP connections (& maybe make sending multiple messages faster).

Fixes T7891

Test Plan: manual

Reviewers: juan, halla

Reviewed By: juan, halla

Subscribers: mark

Maniphest Tasks: T7891

Differential Revision: https://phab.nylas.com/D3997
2017-02-21 16:24:24 -08:00
..
images [client-*] Rename packages folders and update readme 2017-02-16 13:31:37 -08:00
spec [client-*] Rename packages folders and update readme 2017-02-16 13:31:37 -08:00
src [client-sync] Refresh SMTP client when auth credentials change 2017-02-21 16:24:24 -08:00
stylesheets [client-*] Rename packages folders and update readme 2017-02-16 13:31:37 -08:00
main.es6 [client-*] Rename packages folders and update readme 2017-02-16 13:31:37 -08:00
package.json [*] move to monorepo 2017-02-16 18:46:26 -08:00
README.md [*] update and add READMEs to each package 2017-02-17 17:28:09 -08:00

Client Sync

This is the mail sync engine that runs within the Nylas Mail client

It is symlinked in as an internal_package of Nylas Mail via the postinstall script of the root repo.

Important Usage Notes:

Since this is symlinked in as an internal_package of Nylas Mail, there are a handulf of considerations when developing in client-sync. Some common gotchas:

  • You MAY use NylasEnv, NylasExports and other injected libraries in the Nylas Mail client environment.
  • You MAY use any 3rd party library declared in client-app/package.json. Since this gets added as a plugin of the Nylas Mail client, you'll have access to all libraries. This works because the client-app/node_modules was added to the global require paths. That lets us access client-app plugins without being a file directory decendent of client-app (client-sync is now a sibling of client-app)
  • You may NOT add "dependencies" to the client-sync/package.json. If you need a 3rd party library, add it to the main client-app/package.json. All Nylas Mail plugins (those inside of internal_packages), may no longer declare their own dependencies.
  • You should be aggressive at moving generic mail methods to isomorphic-core. We may eventually want to make large chunks of client-sync work in a cloud environment as well.