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

Dont await to write cache in disk to respond to client #551

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

filafb
Copy link
Contributor

@filafb filafb commented Oct 16, 2023

What is the purpose of this pull request?

What problem is this solving?

How should this be manually tested?

Screenshots or example usage

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Requires change to documentation, which has been updated accordingly.

@filafb filafb self-assigned this Oct 19, 2023
@@ -199,7 +199,7 @@ export const cacheMiddleware = ({ type, storage }: CacheOptions) => {
: data

const expiration = Date.now() + (maxAge - currentAge) * 1000
await storage.set(setKey, {
storage.set(setKey, {
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is still in Draft state, but just a suggestion: I feel like the span?.log call on line 210 below should only happen after the write finishes, so that we only log this on success and so that the trace shows the right timestamp for this event.

To do this we'll need to make sure that adding an event to a span after it's closed will work though. It might not be possible. Maybe this event won't make sense within that span anymore actually, since it's an event that happens afterwards, not tied to this span anymore. It'll just be background work now.

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