💌 A beautiful, fast and fully open source mail client for Mac, Windows and Linux.
Find a file
Ben Gotow a14a5212ac feat(transactions): Explicit (and faster) database transactions
Summary:
Until now, we've been hiding transactions beneath the surface. When you call persistModel, you're implicitly creating a transaction.
You could explicitly create them with `atomically`..., but there were several critical problems that are fixed in this diff:

- Calling persistModel / unpersistModel within a transaction could cause the DatabaseStore to trigger. This could result in other parts of the app making queries /during/
  the transaction, potentially before the COMMIT occurred and saved the changes. The new, explicit inTransaction syntax holds all changes until after COMMIT and then triggers.

- Calling atomically and then calling persistModel inside that resulted in us having to check whether a transaction was present and was gross.

- Many parts of the code ran extensive logic inside a promise chained within `atomically`:

  BAD:

```
  DatabaseStore.atomically =>
   DatabaseStore.persistModel(draft) =>
     GoMakeANetworkRequestThatReturnsAPromise
```

OVERWHELMINGLY BETTER:

```
  DatabaseStore.inTransaction (t) =>
     t.persistModel(draft)
  .then =>
    GoMakeANetworkRequestThatReturnsAPromise
```

Having explicit transactions also puts us on equal footing with Sequelize and other ORMs. Note that you /have/ to call DatabaseStore.inTransaction (t) =>. There is no other way to access the methods that let you alter the database. :-)

Other changes:
- This diff removes Message.labels and the Message-Labels table. We weren't using Message-level labels anywhere, and the table could grow very large.
- This diff changes the page size during initial sync from 250 => 200 in an effort to make transactions a bit faster.

Test Plan: Run tests!

Reviewers: juan, evan

Reviewed By: juan, evan

Differential Revision: https://phab.nylas.com/D2353
2015-12-17 11:46:05 -08:00
apm refactor(env): new NylasEnv global 2015-11-17 16:41:20 -08:00
build fix(locales): Copy lproj files to ensure navigator.language works 2015-12-15 11:34:56 -08:00
docs docs(tests): add docs about integration testing 2015-12-11 16:25:25 -05:00
dot-nylas feat(keymap): add new <KeymapHandlers /> 2015-11-06 11:47:06 -08:00
examples fix(quickschedule): Several UI fixes 2015-12-09 16:41:30 -08:00
internal_packages feat(transactions): Explicit (and faster) database transactions 2015-12-17 11:46:05 -08:00
keymaps feat(paste): Paste accepts more HTML, paste and match style now available 2015-12-07 15:34:03 -08:00
menus fix(menu): Toggle Menu Bar doesn't do anything #606 2015-12-09 16:27:47 -08:00
script feat(transactions): Explicit (and faster) database transactions 2015-12-17 11:46:05 -08:00
spec feat(transactions): Explicit (and faster) database transactions 2015-12-17 11:46:05 -08:00
spec_integration add(integration-test): Adds test for onboarding flow with Exchange 2015-12-14 15:14:58 -08:00
src feat(transactions): Explicit (and faster) database transactions 2015-12-17 11:46:05 -08:00
static fix(editable-list): Prevent empty selection on esc pressed + other fixes 2015-12-14 14:29:45 -08:00
.eslintrc Update grunt tasks to lint and transpile es6 code using babel 2015-11-06 17:40:42 -08:00
.gitignore feat(spec): add config dir to integration specs 2015-12-10 10:52:20 -05:00
.gitmodules feat(build): add nylas build resources 2015-12-02 13:59:54 -08:00
.travis.yml fix(ci): stable instead of release/* branches 2015-12-11 17:13:42 -08:00
appveyor.yml fix(ci): stable instead of release/* branches 2015-12-11 17:13:42 -08:00
CHANGELOG.md bump(version): 0.3.32 2015-12-15 11:59:01 -08:00
CONTRIBUTING.md Update CONTRIBUTING.md 2015-10-29 16:58:46 -07:00
LICENSE.md meta(license): Add GPLv3 License 2015-10-01 10:23:42 -07:00
N1.sh fix(spec): cleanup N1.sh and make specs fail with exit code 1 2015-11-23 16:00:55 -05:00
package.json bump(version): 0.3.32 2015-12-15 11:59:01 -08:00
README.md Added link to plugin and theme repo 2015-12-14 14:24:13 -06:00

N1 Logo

N1 Screenshot

N1 is an open-source mail client built on the modern web with Electron, React, and Flux. It is designed to be extensible, so it's easy to create new experiences and workflows around email. N1 is built on the Nylas Sync Engine which is also open source free software.

Build Status Slack Invite Button

Download N1

You can download compiled versions of N1 for Windows, Mac OS X, and Linux (.deb) from https://nylas.com/N1. You can also build and run N1 on Fedora. A Fedora distribution is coming soon!

Build A Plugin

Plugins lie at the heart of N1 and give it its powerful features. Building your own plugins allows you to integrate the app with other tools, experiment with new workflows, and more. Follow the Getting Started guide to write your first plugin in 5 minutes.

If you would like to run the N1 source and contribute, check out our contributing guide.

Running Locally

By default the N1 source points to our hosted version of the Nylas Sync Engine; however, the Sync Engine is open source and you can run it yourself.

Feature Requests / Package Ideas

Have an idea for a package, or a feature you'd love to see in N1? Check out our public Trello board to contribute your thoughts and vote on existing ideas or see the existing plugins and themes.