evernote-random icon indicating copy to clipboard operation
evernote-random copied to clipboard

Lessen use of getUserUrls

Open galtenberg opened this issue 7 years ago • 1 comments

Per Evernote API team:

Looking at our logs, I'm seeing an abnormal number of calls for getUserUrls - 380 calls for a single user. I'd recommend caching the result for a user, the result of that call is unlikely to ever change.

getUserUrls evernote doc: http://dev.evernote.com/doc/reference/UserStore.html#Fn_UserStore_getUserUrls

galtenberg avatar Nov 17 '17 00:11 galtenberg

Likely called by getNoteStore() in the evernote library https://github.com/evernote/evernote-sdk-js/blob/master/src/client.js#L105-L110

What we can do is:

  • In server/controllers/notes.js have notebooks() and randomNote() functions accept a noteStoreUrl param - pass that into calls to client.getNoteStore(noteStoreUrl) (here and here)
  • If req.session.noteStoreUrl exists use it and pass it to those functions - otherwise call a function to obtain it, store it in the session

galtenberg avatar Nov 17 '17 19:11 galtenberg