Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kitsune] Fix resuming feature #80

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

sduenas
Copy link
Member

@sduenas sduenas commented Nov 6, 2024

The backend used the parameter 'offset' to retrieve new data. When an offset is given, the backend considers it as the number of questions that will discard before getting new data, because in the last run it retrieved up to that number of questions.

For example, if on a first retrieval there were 10 questions, the offset will be 10. When the backend runs again using 10 as offset, it will discard the 10 first questions that were updated during that time and, retrieve questions from there.

This approach is totally wrong because there could have been questions updated but discarded. Using the previous example, if after the first retrieval, 10 new questions were created and 10 more were updated, the backend will only fetch 10 and not 20, which were the number of updated questions.

To fix this issue we use the filter 'from_date', that will retrieve those questions updated after a given date.

Notice that the item's field 'updated' on each question is not updated when a new answer is added/updated. For that reason, we need to look for the maximum date in the question and its answers to set the correct metadata value 'updated_on'.

The backend used the parameter 'offset' to retrieve
new data. When an offset is given, the backend considers
it as the number of questions that will discard before
getting new data, because in the last run it retrieved
up to that number of questions.

For example, if on a first retrieval there were 10 questions,
the offset will be 10. When the backend runs again using 10
as offset, it will discard the 10 first questions that were
updated during that time and, retrieve questions from there.

This approach is totally wrong because there could have been
questions updated but discarded. Using the previous
example, if after the first retrieval, 10 new questions were
created and 10 more were updated, the backend will only
fetch 10 and not 20, which were the number of updated questions.

To fix this issue we use the filter 'from_date', that will
retrieve those questions updated after a given date.

Notice that the item's field 'updated' on each question is not
updated when a new answer is added/updated. For that reason,
we need to look for the maximum date in the question and its
answers to set the correct metadata value 'updated_on'.

Signed-off-by: Santiago Dueñas <[email protected]>
@sduenas sduenas requested a review from jjmerchante November 6, 2024 12:22
Copy link
Contributor

@jjmerchante jjmerchante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jjmerchante jjmerchante merged commit 6e7f5ca into chaoss:master Nov 12, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants