Limit the maximum number of retries for failed actions

Summary:
Currently a failed action will run until it works -- for some of them, it means running forever. This diff limits the number of retries to 20 and adds a specific log message when giving up on an action.

It should be interesting to have add to the kibana dashboard a panel with the top failing actions and accounts.

Test Plan:
Ran an always failing action -- checked that it worked
Ran a working action -- checked that it worked

Reviewers: kav-ya, emfree

Reviewed By: kav-ya, emfree

Projects: #sync-engine

Differential Revision: https://review.inboxapp.com/D562
Improve connection error handling in IMAP syncback actions.

Summary:
Previously, when executing IMAP syncback actions, we'd catch our custom
ConnectionError/TransientConnectionError exceptions. This makes no sense
whatsoever, because those are only thrown when a connection is authed, and with
connection pooling, connection auth always happens asynchronously in a separate
greenlet.

But what can happen is that the syncback action fails with a socket error; see
T554. Handle this using the same retry_crispin decorator that we use to handle
analogous socket errors in IMAP sync.

Test Plan: System tests.

Reviewers: kav-ya

Reviewed By: kav-ya

Differential Revision: https://review.inboxapp.com/D595
[SCHEMA] Add index on thread table for improved API performance.

Summary:
Diminishes API response times for /n/<ns_id>/threads?tag=inbox from >10 seconds
to ~780ms.

Test Plan:
Run migration script; benchmark against read replica of prod DB with
and without index.

Reviewers: khamidou

Reviewed By: khamidou

Differential Revision: https://review.inboxapp.com/D616
[SCHEMA] Add account.name column, and "name" attribute to API namespaces.

Summary:
Right now we have this for Gmail and Outlook, and set it from the OAuth
response. But we really need to save this for all accounts, so that we can set
the `From:` header appropriately when sending mail. (We'll add a field to the
login form for generic/eas accounts.) Also expose it in the API's namespace
representation.

Test Plan: Run migration; curl /n/ endpoint.

Reviewers: kav-ya

Reviewed By: kav-ya

Differential Revision: https://review.inboxapp.com/D620