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

Bugfix/zenodo connector rate limits #272

Merged
merged 18 commits into from
Feb 20, 2024

Conversation

jsmatias
Copy link
Member

Bugfixes:

  1. The connector was unable to fetch all records and process them before the resumption token expiration. (422 error from zenodo). This is related to the issue Zenodo connector reaching rate limit #267
    Solution: I separated fetching all records from processing them, and added a timer to stop fetching before the given expiration.
  2. The previous bug resulted in skipping several records.
    Solution: I pass the timestamp of the last processed record to the state. This way the next iteration will start from the last record, instead of to_excl_current, which is defined as next cycle (previous from_incl + time_per_loop)
  3. Zenodo connector was exceeding the request rate limits of the Zenodo platform. This is related to the issue Zenodo connector reaching rate limit #267
    Solution: I used decorators on the fetching methods to define the limits and sleep and retry to avoid raising the 429 error.
  4. Many KeyErrors due to missing fields were not properly addressed. This were all passed to the log files making it less readable to debug and quickly overloads the log files.
    Solution: I used the dictionary .get() method to return a None or default value to be evaluated subsequently.

Changes:

  1. I included a few unit tests to test these bugfixes
  2. Changed the initial date from which the connector starts fetching data 2023 -> 2020

@jsmatias jsmatias self-assigned this Feb 20, 2024
@jsmatias jsmatias linked an issue Feb 20, 2024 that may be closed by this pull request
@jsmatias jsmatias marked this pull request as draft February 20, 2024 12:05
@jsmatias jsmatias marked this pull request as ready for review February 20, 2024 13:05
@jsmatias jsmatias merged commit 4632ea8 into develop Feb 20, 2024
2 checks passed
@andrejridzik andrejridzik deleted the bugfix/zenodo-connector-rate-limits branch February 20, 2024 16:27
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.

Zenodo connector reaching rate limit
2 participants