2016-08-25 42 views
0

我一直在测试列表文件API(仍然使用开发帐户,也许这是问题的一部分?),但看到意外的结果。基本上,我问路径上的信息,处理结果,然后通过“listFolderGetLatestCursor”询问“新”光标,但它说没有变化。我错过了什么吗?Dropbox API游标:它们有效期和使用时间有多长时间

问:有多长光标有效?

问题:如果我运行一个null光标在路径/tmp下面的方法,并预留光标为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; 
} 

感谢

+0

[交叉链接以供参考:https://www.dropboxforum.com/hc/en-us/community/posts/208435823-how-long-is-a-cursor-valid-for-] – Greg

回答

0

基于从Dropbox的论坛反馈,修复是不是一个新的光标问:

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

,因为这将重置轮询

相关问题