Skip to content

Cache invalidation is not working for translations #23

Closed

Description

@JulienPalard

The lines:

for fn ∈ os.listdir(targets_dir):
    if os.stat(os.path.join(targets_dir, fn)).st_ino == target_ino:
        prefixes.append(fn)

from build_docs.py are searching all the http-exposed directories pointing to the currently build directory. It's building a wrong list of directories, not being able to spot he's in a subdirectory:

  • target is /srv/docs.python.org/fr/3.5
  • so targets_dir is /srv/docs.python.org/fr
  • the os.listdir will get the right list of translated versions
  • prefixes will only contain the versions like ['3.6'] not ['fr/3.6']
  • so to_purge will contain something like ['3.5', '3.5/about.html'] missing the fr/ prefix.

Activity

  1. JulienPalard commented on Aug 7, 2017

    @JulienPalard
    MemberAuthor

    Looks like cache invalidation is also broken for the release/ directory as old code was not searching in it so I replaced this with a find -samefile, so translation and release are found. Will close if invalidation goes as expected.

    Side note: Is that normal we're building 3.5 which is a symlink to release/3.5.4/? I first expected folders in release/ to be cp -as of doc during release, and 3.5 is the only one in this case, see:

    lrwxrwxrwx   1 docsbuild docs     3 Oct 28  2012 2 -> 2.7
    lrwxrwxrwx   1 docsbuild docs    13 Oct 28  2012 2.0 -> release/2.0.1
    lrwxrwxrwx   1 docsbuild docs    13 Oct 28  2012 2.1 -> release/2.1.3
    lrwxrwxrwx   1 docsbuild docs    13 Oct 28  2012 2.2 -> release/2.2.3
    lrwxrwxrwx   1 docsbuild docs    13 Oct 28  2012 2.3 -> release/2.3.5
    lrwxrwxrwx   1 docsbuild docs    13 Oct 28  2012 2.4 -> release/2.4.4
    lrwxrwxrwx   1 docsbuild docs    13 Oct 28  2012 2.5 -> release/2.5.4
    lrwxrwxrwx   1 docsbuild docs    13 Oct 29  2013 2.6 -> release/2.6.9
    drwxrwxr-x  19 docsbuild docs  4.0K Jun 28 17:23 2.7
    lrwxrwxrwx   1 nad       docs     3 Dec 23  2016 3 -> 3.6
    lrwxrwxrwx   1 docsbuild docs    13 Oct 28  2012 3.0 -> release/3.0.1
    lrwxrwxrwx   1 docsbuild docs    13 Oct 28  2012 3.1 -> release/3.1.5
    lrwxrwxrwx   1 docsbuild docs    13 Oct 12  2014 3.2 -> release/3.2.6
    lrwxrwxrwx   1 docsbuild docs    13 Oct 12  2014 3.3 -> release/3.3.6
    lrwxrwxrwx   1 larry     larry   13 Jul 25 08:09 3.4 -> release/3.4.7
    lrwxrwxrwx   1 larry     larry   13 Jul 25 08:17 3.5 -> release/3.5.4
    drwxrwxr-x  19 docsbuild docs  4.0K Jul 10 05:15 3.6
    drwxrwxr-x  20 nad       docs  4.0K Aug  2 02:15 3.7
    lrwxrwxrwx   1 nad       docs     3 Dec 23  2016 dev -> 3.7
    
  2. JulienPalard commented on Aug 8, 2017

    @JulienPalard
    MemberAuthor

    There's still an old cache invalidation issue: We're purging directories without trailing slashes, but they are cached with them, like:

    curl -X PURGE "https://docs.python.org/{3.5,3.5/genindex-Y.html,…
    

    It should be:

    curl -X PURGE "https://docs.python.org/{3.5/,3.5/genindex-Y.html,…
    
  3. JulienPalard commented on Aug 10, 2017

    @JulienPalard
    MemberAuthor

    I also suspect switchers.js not to be invalidated by the script as I had to manually invalidate it after python/cpython#3051.

    Used this to invalidate (just in case I have to invalidate again before fixing this):

    $ curl -X PURGE "https://docs.python.org/{,ja/,fr/}{,3.6/,3.7/,dev/,3/}_static/switchers.js"
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions