Dropbox API 游标:它们的有效期有多长,并随着时间的推移正确使用它们

Dropbox API Cursors: how long are they valid for and using them properly over time

我一直在测试列表文件 API(仍在使用开发帐户,也许这是问题的一部分?),但看到了意想不到的结果。基本上,我询问路径信息,处理结果,然后通过 "listFolderGetLatestCursor" 请求 "new" 游标,但它说没有变化。我错过了什么吗?

问题:游标的有效期是多久?

问题: 如果我 运行 以下方法在路径 /tmp 中使用 null 游标并将游标设置为 cursor1 然后修改 /tmp 中的文件,然后 运行 1 天后用 cursor1 相同的方法,返回 cursor2 它没有显示任何更改。有时,当我在较短的时间间隔内 运行 时,我似乎得到了预期的结果,但我一定遗漏了一些东西。

public String doDropboxWork(String path, String cursor) {
  // make request for path
    if (cursor == null) {
        ListFolderBuilder listFolderBuilder = client.files().listFolderBuilder(path);
        result = listFolderBuilder.withRecursive(true).withIncludeDeleted(false).start();
    } else {
        result = client.files().listFolderContinue(cursor);
    }

    while (true) {
       // ... do work ....
        if (!result.getHasMore()) {
            break;
        }
        result = client.files().listFolderContinue(result.getCursor());
    }

   // get new cursor
   String cursor2 = client.files().listFolderGetLatestCursor(path).getCursor();
   return cursor2;
}

提前致谢

根据 Dropbox 论坛的反馈,解决方法是不要求新光标:

eg:
//String cursor2 = client.files().listFolderGetLatestCursor(path).getCursor();

因为这会重置轮询