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

Add Conditional Caching for DOI Fetch Requests #444

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

jrhoads
Copy link
Contributor

@jrhoads jrhoads commented Jan 20, 2025

Purpose

Improve data fetching with conditional caching for DOI queries to optimize performance and reduce unnecessary network requests.

Approach

Implement a custom fetchConditionalCache utility function to handle conditional caching for fetch requests, specifically for DOI data retrieval.

Key Modifications

  • Created a new fetchConditionalCache.ts utility function
  • Modified doiQuery.ts to use the new conditional caching fetch method
  • Added default cache revalidation of 1 hour
  • Implemented flexible caching options

Important Technical Details

  • Introduces a custom fetch wrapper that:
    • Allows configurable cache revalidation
    • Defaults to 1-hour cache if no revalidation time is specified
    • Handles failed requests gracefully
  • Uses Next.js fetch caching mechanism
  • Provides flexibility in cache configuration through optional parameters

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Reviewer, please remember our guidelines:

  • Be humble in the language and feedback you give, ask don't tell.
  • Consider using positive language as opposed to neutral when offering feedback. This is to avoid the negative bias that can occur with neutral language appearing negative.
  • Offer suggestions on how to improve code e.g. simplification or expanding clarity.
  • Ensure you give reasons for the changes you are proposing.

Copy link

cypress bot commented Jan 20, 2025

akita    Run #1508

Run Properties:  status check passed Passed #1508  •  git commit 19b3c533ae ℹ️: Merge 3f9bc2b30f189ca175562c7c7ffe542ff0aca9fe into c22c6f33af9d82b1dc5022a39de3...
Project akita
Branch Review only-cache-ok-requests
Run status status check passed Passed #1508
Run duration 01m 52s
Commit git commit 19b3c533ae ℹ️: Merge 3f9bc2b30f189ca175562c7c7ffe542ff0aca9fe into c22c6f33af9d82b1dc5022a39de3...
Committer Joseph Rhoads
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 3
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 52
View all changes introduced in this branch ↗︎

@jrhoads jrhoads requested review from bklaing2, codycooperross and a team January 20, 2025 14:28
@jrhoads jrhoads merged commit 3154898 into master Jan 21, 2025
12 checks passed
@jrhoads jrhoads deleted the only-cache-ok-requests branch January 21, 2025 13:28
Copy link

cypress bot commented Jan 21, 2025

akita    Run #1509

Run Properties:  status check passed Passed #1509  •  git commit 31548989ed: Merge pull request #444 from datacite/only-cache-ok-requests
Project akita
Branch Review master
Run status status check passed Passed #1509
Run duration 01m 37s
Commit git commit 31548989ed: Merge pull request #444 from datacite/only-cache-ok-requests
Committer Joseph Rhoads
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 1
Tests that did not run due to a developer annotating a test with .skip  Pending 3
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 52
View all changes introduced in this branch ↗︎

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