Summary:
Instead of re-implementing exponential backoff, throw the retryable
error so the sync loop handles it and backs-off
Test Plan: manual
Reviewers: spang, halla
Reviewed By: halla
Differential Revision: https://phab.nylas.com/D3914
Summary:
This commit rewrites the offline status notification from scratch, using
the `is-online` module (https://github.com/sindresorhus/is-online). The
react component no longer manages all of the state internally, but
rather depends on a separate OnlineStatusStore that manages the online state
for that component.
The new online status system will:
- Check online status every 30 seconds
- If status switches to offline:
- Show notification
- Recheck online status using exponential backoff
- Notification will show remaining seconds until next online status
check (like slack) (upon initial inspection this seemed to have no cpu problems.)
- If status switches to online
- Hide notification
- Revert to checking online status every 30 seconds
Depends on D3919
Test Plan: manual
Reviewers: spang, mark, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D3920
Summary:
Update Salesforce to use the new search indexer
Depends on D3911
Test Plan: Manually bootup SFDC and ensure it launches and indexes models properly
Reviewers: mark, halla, juan
Reviewed By: juan
Differential Revision: https://phab.nylas.com/D3913
Summary:
This renames `SearchIndexer` to `SearchIndexScheduler`
It also moves it out of internal_packages and into src/ since this is now
used across packages (like in Salesforce).
It also makes the class a Singleton and exports that instead so we don't
need to pass it via `activate`. The `activate` method of many stores and
packages are designed to be argumentless.
Test Plan:
Boot up Nylas and ensure it's still indexing threads properly.
Also allows Salesforce to bootup with the SalesforceSearchIndexer
Reviewers: juan, mark
Reviewed By: mark
Differential Revision: https://phab.nylas.com/D3911
Summary:
This will help us dry up exponential backoffs we have scattered in
several places
Test Plan: unit tests
Reviewers: mark, spang, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D3919
Summary:
This component was running into a hard loop trying to constantly, unnecessarily,
re-establish the delta connection to our n1cloud servers.
Test Plan: manual
Reviewers: mark, evan, spang
Reviewed By: evan, spang
Differential Revision: https://phab.nylas.com/D3918
Summary: Report delta errors and exponential backoff when errors arise
Test Plan: Manually throw Errors in various parts of the delta stream
Reviewers: spang, juan
Reviewed By: juan
Differential Revision: https://phab.nylas.com/D3917
Summary: Should help a fair bit with our redis connection pileup.
Test Plan: Tested manually.
Reviewers: mark, spang, juan, evan
Reviewed By: mark, spang, evan
Differential Revision: https://phab.nylas.com/D3916
Summary:
We were doing a lazy job of removing prefixes and suffixes by filtering
any and all prefixes or suffixes from any part of a Contact's name which
was leading to some odd truncations.
Test Plan:
Run locally, verify that 'Nylas Mail General' contact has proper name
when participant text field is collapsed.
Reviewers: evan, spang, juan
Reviewed By: juan
Differential Revision: https://phab.nylas.com/D3904
Summary:
Re-enable DatabaseStore specs and use new async model that awaits for the
promises to resolve
Test Plan: new tests
Reviewers: spang, halla, juan
Reviewed By: juan
Differential Revision: https://phab.nylas.com/D3909
Summary:
Some plugins (like the Salesforce Plugin) register Models with the
database store. Upon plugin load, we check to see if there are newly
registered models, if there are, we try and refresh the database.
Unfortunately the database refresh was not being `await`ed for. This means
the `activate` method of the plugin was called before the models were
created creating DB errors.
Making `refreshDatabaseSchema` something you can `await` for requied
adding an async ready hook on the DatabaseStore itself that will work in
all windows, even though setup is only happening in one window.
Test Plan:
Turn DatabaseStore.DEBUG_TO_LOG = true and run before and after the patch
with SFDC enabled. See that after the patch the DB setup happens before
activate gets called
Reviewers: halla, spang, juan
Reviewed By: juan
Differential Revision: https://phab.nylas.com/D3906
Summary:
This commit makes it so we always continue retrying syncback tasks as long as they
error with a retryable error. There's really no reason to not continue retrying syncback
tasks after an arbitrary number of retries (especially such a low one) if we
encounter a retryable error. Before this commit, if for example we got 2 random
network errors in a row, we would just mark the task as failed even
though it would eventually succeed in subsequent attempts.
Previously, when N1 synced against the cloud api, we would indefinitely
retry a Task if we continued getting retryable errors. This ensures that
the app can work correctly offline and prevents displaying unecessary errors to
the user, and having actions bouncing back or sending messages without putting them
in the sent folder.
Additionally, this commit ensures that when cleaning up messages without a
folderImapUID we don't delete messages that are currently being added to the sent
folder. This is relevant to this commit because given that we could retry the
EnsureMessageInSentFolder task indefinitely, we might end up deleting that
message because it wont have a uid until the task succeeds.
Depends on D3898
Test Plan: manual
Reviewers: mark, spang, evan, halla
Reviewed By: spang, evan, halla
Differential Revision: https://phab.nylas.com/D3900
Summary:
When loading accounts, if we detect any removed accounts, we should get
rid of the tokens for that account as well.
Test Plan: manually removed accounts, everything seems a-ok
Reviewers: mark, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D3907
Summary:
Since all Nylas Mail actions are thread-based except for sending,
we never use any of these. Make `git grep` less confusing by getting rid
of them.
Test Plan: use the app
Reviewers: evan, halla, juan
Reviewed By: juan
Differential Revision: https://phab.nylas.com/D3910
Summary:
The current error condition check is to make sure that accounts are exclusively
removed via `Actions.removeAccount`. However, when removing accounts,
the in-memory `AccoutStore`s in each window are kept in sync via listening
to the config, as opposed to dispatching Actions globally between windows
(Actions.removeAccount is scoped to a single window, see actions.es6).
So, when we remove an account in one window, config.json will change, and the
other windows will always encounter `removedIds.length > 0` to be true
when their `_loadAccounts` runs. This will only generate unecessary noise in Sentry.
Test Plan: manual
Reviewers: mark, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D3902
Summary:
Previously, if you were to close the app while you had any tasks queued,
these would be marked as failed the next time you open the app, showing
an annoying error message and reverting any optimisitic actions.
However, we don't need to be so defensive about retrying tasks because
the only tasks we can't retry are the Sending tasks. All of the other
tasks like moving or changing labels are fine to retry (trying move the same
set of uids twice wont cause an error)
This commit adds an extra status to syncback requests, "NOTRETRYABLE".
Only NOTRETRYABLE requests will be marked as failed at the beginning of
the sync loop, and any INPROGRESS tasks will be marked as NEW so they
can be retried
Depends on D3896
Test Plan: manual
Reviewers: mark, evan, spang, halla
Reviewed By: evan, halla
Differential Revision: https://phab.nylas.com/D3898
Summary:
- Create ghost models if we receive metadata for an object we
haven't synced yet
- Fix logic for finding equivalent threads
- Send `messageIds` when syncing thread metadata
See D3876 for unit tests
K2 pairing: D3880
Test Plan: unit tests, local testing soon
Reviewers: juan, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D3875
Summary:
Now that we don't run Send tasks outside the sync loop, we don't need
that awful hack wich required passing a `runTask` callback to
`runSyncbackTask` in order to customize how to run the task.
Instead, runSyncbackTask now knows 2 ways to run a task, either via imap, or
via smtp, depending on the resource declared by task to run. So now
SyncbackTasks declare a resource type they need to run, and that will be
passed as their second argument when running.
Depends D3894
Test Plan: manual
Reviewers: mark, halla, spang, evan
Reviewed By: halla, spang, evan
Differential Revision: https://phab.nylas.com/D3896
Summary:
We had previously ripped send tasks outside the sync loop to make them run faster,
but they run fast enough inside the loop.
This commit will also fix the scenario where if you closed the app in the
middle of a send task, the task would just hang forever and never succeed or
fail (T7818); given that it was excluded from the loop, we also had to exclude it
from the cleanup step to mark any INPROGRESS tasks as failed at the beginning
of each loop, which caused send tasks in progress to never get cleaned.
Putting them back inside the loop allows us to fix this without adding more messy
logic, and it cleans up ugly duplicated code. Additionally, it will prevent more
duplicated code for upcoming diffs that will improve syncback task reliability
when the app is closed or window is restarted in the middle of a task.
Depends on D3893
Test Plan:
manually test sending, it still works, it's still fast. Restarted
window in the middle of send task, task fails.
Reviewers: mark, spang, halla, evan
Reviewed By: spang, halla, evan
Differential Revision: https://phab.nylas.com/D3894
Summary:
[cloud-api]
Based on the passed in `messageIds`, it finds any existing thread
metadata that might be under a different thread id. If it realizes
there are actually multiple threads that should be the same thread,
(due to getting a missing message link), it reconciles all of them.
[local-sync]
Return `message_ids` in `Thread.toJSON()`
See D3879 for tests
N1 Pairing: D3875
Test Plan: unit tests, local testing soon
Reviewers: juan, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D3880
Summary:
Instead of exposing helper functions, make this a class to hold the
shared state of the db, account, and logger required to run any syncback
inside an account sync loop.
Test Plan: manual
Reviewers: mark, spang, halla, evan
Reviewed By: spang, halla, evan
Differential Revision: https://phab.nylas.com/D3893
Summary:
See title.
I believe this might fix T7559, or at least provide a better error message.
Depends on D3895
Test Plan: manual
Reviewers: spang, mark, halla, evan
Reviewed By: mark, halla, evan
Maniphest Tasks: T7559
Differential Revision: https://phab.nylas.com/D3897
Summary:
If the worker window were to restart or the app were to close in the
middle of a send task, sending to a single recipient, we would not
properly await the task and always mark as success.
This diff, along with (D3897) should fix T7559.
Test Plan: manual
Reviewers: spang, mark, evan, halla
Reviewed By: mark, evan, halla
Maniphest Tasks: T7559
Differential Revision: https://phab.nylas.com/D3895
Summary:
See title.
I really wish we could clean up this error handling a bit better, but I don't
think its super important right now.
Test Plan: manual
Reviewers: spang, evan, halla
Reviewed By: evan, halla
Differential Revision: https://phab.nylas.com/D3903
Summary:
A prerequesite to integrating with `arc unit` or CI for each patchset is
being able to generate JUnit XML output for spec runs. This commit adds
this feature using the JUnitXMLReporter from jasmine-reporters. Invoke it like
this:
npm run test-junit
(We output to the terminal as well when this is run, so in the case that
you're doing `arc diff` you have some idea of what is going on.)
Test Plan: run it
Reviewers: halla, juan, evan
Reviewed By: juan, evan
Differential Revision: https://phab.nylas.com/D3891