Question 4 of 249 from exam PCA: Professional Cloud Architect

Question 4 of 249 from exam PCA: Professional Cloud Architect

Question

A news feed web service has the following code running on Google App Engine.

During peak load, users report that they can see news articles they already viewed.

What is the most likely cause of this problem?

import news
from flask import Flask, redirect, request
from flask.ext.api import status

from google-appengine.api import users

app = Flask(_name_)
sessions = {}

@app. route ("/”)

def homepage ():
user = users.get_current_user()
if not user:

return “Invalid login”,
status.HTTP_401_UNAUTHORIZED

if user not in session

sessions[user] = {“viewed”: []}

news_articles = news.get_new_news (user, sessions [user]
(viewed”])

sessions [user] [“viewed”] +- [n["id”] for n
in news_articles]

return news. render (news_articles)

if _name main”:

app. run ()

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

A.