From 3c9db9bd85cb3dd1172f38fe9301f1f00a64a3a5 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Fri, 29 Jan 2016 16:06:33 -0800 Subject: [PATCH] fix(activity): "Long Polling" => "Delta Streaming" because we don't really poll. --- docs/Debugging.md | 2 +- .../worker-sync/lib/nylas-long-connection.coffee | 6 +++--- .../worker-sync/spec/nylas-sync-worker-spec.coffee | 4 ++-- internal_packages/worker-ui/lib/developer-bar.cjsx | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/Debugging.md b/docs/Debugging.md index 33beb8673..18740ce84 100644 --- a/docs/Debugging.md +++ b/docs/Debugging.md @@ -27,7 +27,7 @@ The Developer Panel provides three views which you can click to activate: - `Tasks`: This view allows you to inspect the {TaskQueue} and see the what tasks are pending and complete. Click a task to see its JSON representation and inspect it's values, including the last error it encountered. -- `Long Polling`: This view allows you to see the streaming updates from the Nylas API that the app has received. You can click individual updates to see the exact JSON that was consumed by the app, and search in the lower left for updates pertaining to an object ID or type. +- `Delta Streaming`: This view allows you to see the streaming updates from the Nylas API that the app has received. You can click individual updates to see the exact JSON that was consumed by the app, and search in the lower left for updates pertaining to an object ID or type. - `Requests`: This view shows the requests the app has made to the Nylas API in `curl`-equivalent form. (The app does not actually make `curl` requests). You can click "Copy" to copy a `curl` command to the clipboard, or "Run" to execute it in a new Terminal window. diff --git a/internal_packages/worker-sync/lib/nylas-long-connection.coffee b/internal_packages/worker-sync/lib/nylas-long-connection.coffee index 5edd63ffb..e43c6820c 100644 --- a/internal_packages/worker-sync/lib/nylas-long-connection.coffee +++ b/internal_packages/worker-sync/lib/nylas-long-connection.coffee @@ -99,7 +99,7 @@ class NylasLongConnection @withCursor (cursor) => return if @state is NylasLongConnection.State.Ended - console.log("Long Polling Connection: Starting for account #{@_accountId}, token #{token}, with cursor #{cursor}") + console.log("Delta Connection: Starting for account #{@_accountId}, token #{token}, with cursor #{cursor}") options = url.parse("#{@_api.APIRoot}/delta/streaming?cursor=#{cursor}&exclude_folders=false") options.auth = "#{token}:" @@ -113,7 +113,7 @@ class NylasLongConnection if res.statusCode isnt 200 res.on 'data', (chunk) => if chunk.toString().indexOf('Invalid cursor') > 0 - console.log('Long Polling Connection: Cursor is invalid. Need to blow away local cache.') + console.log('Delta Connection: Cursor is invalid. Need to blow away local cache.') # TODO THIS! else @retry() @@ -158,7 +158,7 @@ class NylasLongConnection , startDelay end: -> - console.log("Long Polling Connection: Closed.") + console.log("Delta Connection: Closed.") @setState(NylasLongConnection.State.Ended) @cleanup() diff --git a/internal_packages/worker-sync/spec/nylas-sync-worker-spec.coffee b/internal_packages/worker-sync/spec/nylas-sync-worker-spec.coffee index 0d834c60c..f972bf907 100644 --- a/internal_packages/worker-sync/spec/nylas-sync-worker-spec.coffee +++ b/internal_packages/worker-sync/spec/nylas-sync-worker-spec.coffee @@ -45,7 +45,7 @@ describe "NylasSyncWorker", -> expect(@worker.state().contacts.busy).toEqual(false) describe "start", -> - it "should open the long polling connection", -> + it "should open the delta connection", -> spyOn(@connection, 'start') @worker.start() advanceClock() @@ -312,7 +312,7 @@ describe "NylasSyncWorker", -> expect(@worker.state().threads.errorRequestRange).toEqual(null) describe "cleanup", -> - it "should termiate the long polling connection", -> + it "should termiate the delta connection", -> spyOn(@connection, 'end') @worker.cleanup() expect(@connection.end).toHaveBeenCalled() diff --git a/internal_packages/worker-ui/lib/developer-bar.cjsx b/internal_packages/worker-ui/lib/developer-bar.cjsx index 2a03cf4a2..141acb845 100644 --- a/internal_packages/worker-ui/lib/developer-bar.cjsx +++ b/internal_packages/worker-ui/lib/developer-bar.cjsx @@ -44,7 +44,7 @@ class DeveloperBar extends React.Component { _.map @state.longPollState, (val, key) =>
} - Long Polling + Delta Streaming