mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-23 07:36:12 +08:00
fix(deltas): Use the official API to create cursors
This commit is contained in:
parent
6d1dbe1dbf
commit
b11ab8406b
1 changed files with 5 additions and 8 deletions
|
@ -46,17 +46,14 @@ class NylasLongConnection
|
||||||
cursor = atom.config.get(@_cursorKey)
|
cursor = atom.config.get(@_cursorKey)
|
||||||
return callback(cursor) if cursor
|
return callback(cursor) if cursor
|
||||||
|
|
||||||
stamp = Math.round(new Date().getTime() / 1000.0)
|
|
||||||
@_api.makeRequest
|
@_api.makeRequest
|
||||||
path: "/delta/generate_cursor"
|
path: "/delta/latest_cursor"
|
||||||
accountId: @_accountId
|
accountId: @_accountId
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
body: { "start": stamp }
|
success: ({cursor}) =>
|
||||||
success: (json) =>
|
console.log("Obtained stream cursor #{cursor}.")
|
||||||
@setCursor(json['cursor'])
|
@setCursor(cursor)
|
||||||
callback(json['cursor'])
|
callback(cursor)
|
||||||
console.log("Retrieved cursor #{json['cursor']} from \
|
|
||||||
`generate_cursor` with timestamp: #{stamp}")
|
|
||||||
|
|
||||||
setCursor: (cursor) ->
|
setCursor: (cursor) ->
|
||||||
atom.config.set(@_cursorKey, cursor)
|
atom.config.set(@_cursorKey, cursor)
|
||||||
|
|
Loading…
Reference in a new issue