denshoproject / encyc-front

front-end interface for the encyclopedia
Other
1 stars 0 forks source link

Authors' page names intermittently replaced with gibberish #84

Closed gjost closed 4 years ago

gjost commented 4 years ago

Running redis-cli flushall on the server fixes the problem, but it only re-occurs later.

gjost commented 4 years ago

Problem reoccurred on stage site. Here is a sample of the affected area:

<div class="authors row">
  <div class="span3">
    <a href="">mw_api_url</a><br/>
    <a href="">title_sort</a><br/>
    <a href="">public</a><br/>
    <a href="">url_title</a><br/>
    <a href="">article_titles</a><br/>
    <a href="">modified</a><br/>
    <a href="">published</a><br/>
    <a href="">title</a><br/>
    <a href="">body</a><br/>
  </div>

It's printing just the field names. View code:

def authors(request, template_name='wikiprox/authors.html'):
    return render(request, template_name, {
        'authors': models.Author.authors(num_columns=4),
    })

Running this in python shell returns a list of Author objects:

>>> from wikiprox import models
>>> models.Author.authors(num_columns=4)
[<wikiprox.models.Author "Kaori Akiyama">, <wikiprox.models.Author "Jasmine Alinder">, <wikiprox.models.Author "Emily Anderson">, <wikiprox.models.Author "Megan Asaka">, <wikiprox.models.Author "Gil Asakawa">, <wikiprox.models.Author "Allan W. Austin">, <wikiprox.models.Author "Eiichiro Azuma">, <wikiprox.models.Author "Anne Blankenship">, <wikiprox.models.Author "Matthew M. Briones">, <wikiprox.models.Author "Kayla Canelo">, <wikiprox.models.Author "John Christgau">, <wikiprox.models.Author "Sheila H. Chun">, <wikiprox.models.Author "Bonnie J. Clark">, <wikiprox.models.Author "Tom Coffman">, <wikiprox.models.Author "Jennifer Cronk">, <wikiprox.models.Author "Klancy de Ne
gjost commented 4 years ago

It appears that models.Author.authors is not returning the answers in columns as requested.

gjost commented 4 years ago

The cache key in models.Author.authors did not include the num_columns arg.

    def authors(num_columns=None):
        KEY = 'encyc-front:authors'
        data = cache.get(KEY)
        if not data:
            searcher = search.Searcher()

If the function was called without the arg then the authors page would break. If the function was called with the arg i.e. by the authors list page, then something else probably broke.

gjost commented 4 years ago

Fixed in encycfront commit f11455c for package encycfront-develop_4.0.0-rc2~deb9.

gjost commented 4 years ago

Manual fix made to encyc-front in production since I expect to upgrade to 4.0.0 tomorrow.