<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Update latency for files_list_folder cursor in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Update-latency-for-files-list-folder-cursor/m-p/538992#M25878</link>
    <description>&lt;P&gt;I figured out what the issue here was - it's the way my code was handling results pages and cursors.&amp;nbsp; I switched the loop control checks around a bit and it all started working fine:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def poll_loop(client: DropboxClient,
              db_path: str,
              poll_freq: int,
              db_cursor: str = None):
    if db_cursor is None:
        list_result = client.files_list_folder(path=db_path, recursive=True)
    else:
        list_result = client.files_list_folder_continue(db_cursor)

    while True:
        log.info("scan files from cursor %s", list_result.cursor)
        while list_result.entries:
            for entry in list_result.entries:
                log.info("scanned path: %s", entry.path_display)

            if list_result.has_more:
                list_result = client.files_list_folder_continue(list_result.cursor)
                log.debug("new cursor %s", list_result.cursor)
            else:
                log.debug("cursor is exhausted")
                break

        if poll_freq == 0:
            log.info("final cursor: %s", list_result.cursor)
            return
        else:
            log.debug("pause for %d seconds before next poll", poll_freq)
            log.info("latest cursor: %s", list_result.cursor)
            time.sleep(poll_freq)
            list_result = client.files_list_folder_continue(list_result.cursor)&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 12 Aug 2021 14:54:33 GMT</pubDate>
    <dc:creator>RobinHarveyIW</dc:creator>
    <dc:date>2021-08-12T14:54:33Z</dc:date>
    <item>
      <title>Update latency for files_list_folder cursor</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Update-latency-for-files-list-folder-cursor/m-p/538941#M25875</link>
      <description>&lt;P&gt;I'm trialing the simple polling method &lt;A href="https://developers.dropbox.com/detecting-changes-guide" target="_self"&gt;outlined here&lt;/A&gt;, and AFAICS it's taking a few hours for changes in my DB folders / files to be reflected in the results of &lt;FONT face="andale mono,times"&gt;files_list_folder&lt;/FONT&gt; and &lt;FONT face="andale mono,times"&gt;files_list_folder_continue&lt;/FONT&gt;.&amp;nbsp; Is this expected?&amp;nbsp; I was hoping that updates would be visible in API results in the seconds-to-minutes range, do I need to use a different API to get near this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my code, in case I've messed anything up &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@FBF7D2AB59A0D6E861EBF6A36F93B7E2/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;def poll_loop(client: DropboxClient,
              db_path: str,
              poll_freq: int,
              db_cursor: str = None):
    if db_cursor is None:
        list_result = client.files_list_folder(path=db_path, recursive=True)
    else:
        list_result = client.files_list_folder_continue(db_cursor)

    while True:
        log.info("scan files from cursor %s", list_result.cursor)
        while list_result.has_more:
            for entry in list_result.entries:
                log.info("scanned path: %s", entry.path_display)
            list_result = client.files_list_folder_continue(list_result.cursor)
            log.info("new cursor %s", list_result.cursor)
        if poll_freq == 0:
            return
        else:
            log.info("pause for %d seconds before next poll", poll_freq)
            time.sleep(poll_freq)
            list_result = client.files_list_folder_continue(list_result.cursor)
            log.info("new cursor %s", list_result.cursor)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 11:11:27 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Update-latency-for-files-list-folder-cursor/m-p/538941#M25875</guid>
      <dc:creator>RobinHarveyIW</dc:creator>
      <dc:date>2021-08-12T11:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Update latency for files_list_folder cursor</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Update-latency-for-files-list-folder-cursor/m-p/538992#M25878</link>
      <description>&lt;P&gt;I figured out what the issue here was - it's the way my code was handling results pages and cursors.&amp;nbsp; I switched the loop control checks around a bit and it all started working fine:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def poll_loop(client: DropboxClient,
              db_path: str,
              poll_freq: int,
              db_cursor: str = None):
    if db_cursor is None:
        list_result = client.files_list_folder(path=db_path, recursive=True)
    else:
        list_result = client.files_list_folder_continue(db_cursor)

    while True:
        log.info("scan files from cursor %s", list_result.cursor)
        while list_result.entries:
            for entry in list_result.entries:
                log.info("scanned path: %s", entry.path_display)

            if list_result.has_more:
                list_result = client.files_list_folder_continue(list_result.cursor)
                log.debug("new cursor %s", list_result.cursor)
            else:
                log.debug("cursor is exhausted")
                break

        if poll_freq == 0:
            log.info("final cursor: %s", list_result.cursor)
            return
        else:
            log.debug("pause for %d seconds before next poll", poll_freq)
            log.info("latest cursor: %s", list_result.cursor)
            time.sleep(poll_freq)
            list_result = client.files_list_folder_continue(list_result.cursor)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 12 Aug 2021 14:54:33 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Update-latency-for-files-list-folder-cursor/m-p/538992#M25878</guid>
      <dc:creator>RobinHarveyIW</dc:creator>
      <dc:date>2021-08-12T14:54:33Z</dc:date>
    </item>
  </channel>
</rss>

