We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

rodriguezo's avatar
rodriguezo
Explorer | Level 3
2 years ago

get_last_cursor() is constantly changes

Hello,
In my application I've implemented this logic in order to reduce significatly the traffic, but get_last_cursor() doesn't seem to work properly.

 

  1. I store the cursor from my last list_folder/continue recursive call to a specific path.
  2. Webhook get triggered by Dropbox, so I call get_last_cursor() at the same path.
  3. I compare the retrieved cursor with the stored one, if not matching, I proceed to update the information with list_folder/continue with the OLDER  stored cursor set at the same path.
  4. After information update, repeat from point 1.

Issue: In the next call get_last_cursor() result always changes so It's also never matching my stored cursor, even if no edit nor API calls has been done at the specified path, making the optimization worthless.
I also tried to store the cursor from an extra get_last_cursor() call just after the recursive call from last list_folder/continue, but with same result.

From api docs "A way to quickly get a cursor for the folder's state.", but looks like the folder's state is constantly changes, even if it's not.

How can I solve?


Thanks in advance.

  • Hi rodriguezo,

    You have conceptual mistake. Cursor (including the last one) represent somehow particular enumeration state. It's an opaque object and you shouldn't suppose existence of any features that are not explicitly supported (that what you are actually doing)! Where did you read that cursors are comparable? 🧐 Actually, they are not and you should use them as arguments to appropriate APIs only (as described in the documentation). 😉 Even more: in your particular case you don't need the last cursor. It's clear what you are trying to optimize, but (as I mentioned) it's impossible.

    Hope this clarifies matter.

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    Hi rodriguezo,

    You have conceptual mistake. Cursor (including the last one) represent somehow particular enumeration state. It's an opaque object and you shouldn't suppose existence of any features that are not explicitly supported (that what you are actually doing)! Where did you read that cursors are comparable? 🧐 Actually, they are not and you should use them as arguments to appropriate APIs only (as described in the documentation). 😉 Even more: in your particular case you don't need the last cursor. It's clear what you are trying to optimize, but (as I mentioned) it's impossible.

    Hope this clarifies matter.

    • rodriguezo's avatar
      rodriguezo
      Explorer | Level 3

      Hi @Здравко thank you for your reply, 
      Following th API Docs here :

       

      A way to quickly get a cursor for the folder's state. Unlike list_folderlist_folder/get_latest_cursor doesn't return any entries. This endpoint is for app which only needs to know about new files and modifications and doesn't need to know about files that already exist in Dropbox

      Now I'm a bit confused, in which way this cursor, or in general this endpoint, is working in order to retrieve updated information about new files and modification?


      Thanks