Skip to content

ADR 08 ‐ Questions Database Functioning

Pablo García-Ovies Pérez edited this page Apr 7, 2024 · 1 revision

Status

  • Proposed
  • Accepted
  • Superseded

Context

We have to decide how the questions service is being implemented.

Decision

As we don't want questions to be repeated, we will implement the /question route, removing the questions extracted from the DB. Besides, from now on, we will establish two thresholds:

  • high threshold will establish the minimum amount of questions stored. Every time a question is requested, leaving the question count below that, it will asynchronously generate more questions.
  • low threshold will establish a limit to the number of questions in the DB from which we will not delete the questions extracted. We will risk repeating some questions, but we'd rather assume that than completely emptying the collection.
  • special case when 0 questions are available, in which we have to synchronously generate a pair of questions before keeping generating until we reach the high threshold asynchronously.

Everytime we have to generate questions we try to get above the high threshold leaving a little margin.

It would be great, in a future, to study weather we can generate questions whenever the service is inactive or not getting a lot of requests.

Consequences

  • Benefits:

    • Never lacking questions: As we will never remove the last questions, the requests will always be satisfied.
    • Lower response time: Requests do not require a Wikidata query to be performed, so the service will be much faster.
    • Low probability of repetition: As we are leaving a margin between the amount of questions at which we generate more and the amount at which we stop deleting, there will only be a low probability of repeating the same question for the same user in cases of high demand for questions.
  • Trade-offs:

    • Not keeping track of all the questions done: As we delete the questions, we will not be able to establish any tracking of them.
    • Probability of repetition: It is low, yes, but it still exists.

Compliance

We will implement and test the service functioning this way.

Notes

  • Original Author: @PabloGOP
  • Approval date: 26/03/2024
  • Approved by: MM 16 - Remote 08
  • Superseded date: N/A
  • Last modified date: N/A
  • Modified by: N/A
  • Last modification: N/A