Skip to content

Conversation

@albertoberto
Copy link

PropertiesFetcher#last was sorting the records in descending order and then taking the last one, effectively meaning that it returned the first one.

This change fixes the issue by sorting the records in ascending order instead.

Copy link
Collaborator

@sergio-bobillier sergio-bobillier left a comment

Choose a reason for hiding this comment

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

Missing entry in the CHANGELOG.md file.

PropertiesFetcher#last was sorting the records in descending order and
then taking the last one, effectively meaning that it returned the
first one.

This change fixes the issue by sorting the records in ascending order
instead.
@albertoberto albertoberto force-pushed the ab-fix-properties-fetcher-last branch from d30bc40 to 41c54f5 Compare March 13, 2025 09:53
Copy link
Collaborator

@sergio-bobillier sergio-bobillier left a comment

Choose a reason for hiding this comment

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

🚀

@albertoberto albertoberto merged commit 9291f29 into master Mar 13, 2025
3 checks passed
@albertoberto albertoberto deleted the ab-fix-properties-fetcher-last branch March 13, 2025 16:00
sergio-bobillier added a commit that referenced this pull request Dec 12, 2025
The commit being reverted was supposed to fix an issue in the
PropertiesFetcher class's #last method, however, that issue nuever
existed to begin with.

The argument for the fix was that #last was sorting in descending order
and then taking the last, which would effectively return the first,
however, that is not true, because it is also asking Elasticsearch for
a single document (by calling #size with its parameter set to 1).

Hence, Elasticsearch would return a single document, the last entry in
the index (ordered chronologically). So the logic was correct to begin
with.

This fixes the issue by reverting the changes introduced by #11
sergio-bobillier added a commit that referenced this pull request Dec 12, 2025
The commit being reverted was supposed to fix an issue in the
PropertiesFetcher class's #last method, however, that issue never
existed to begin with.

The argument for the fix was that #last was sorting in descending order
and then taking the last, which would effectively return the first,
however, that is not true, because it is also asking Elasticsearch for
a single document (by calling #size with its parameter set to 1).

Hence, Elasticsearch would return a single document, the last entry in
the index (ordered chronologically). So the logic was correct to begin
with.

This fixes the issue by reverting the changes introduced by #11
sergio-bobillier added a commit that referenced this pull request Dec 12, 2025
The commit being reverted was supposed to fix an issue in the
PropertiesFetcher class's #last method, however, that issue never
existed to begin with.

The argument for the fix was that #last was sorting in descending order
and then taking the last, which would effectively return the first,
however, that is not true, because it is also asking Elasticsearch for
a single document (by calling #size with its parameter set to 1).

Hence, Elasticsearch would return a single document, the last entry in
the index (ordered chronologically). So the logic was correct to begin
with.

This fixes the issue by reverting the changes introduced by #11
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.

3 participants