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

Check if blobs are expired before returning #695

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions disperser/apiserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,12 @@ func (s *DispersalServer) RetrieveBlob(ctx context.Context, req *pb.RetrieveBlob
return nil, api.NewInternalError("failed to get blob metadata, please retry")
}

if blobMetadata.Expiry < uint64(time.Now().Unix()) {
s.metrics.HandleNotFoundRpcRequest("RetrieveBlob")
s.metrics.HandleNotFoundRequest("RetrieveBlob")
return nil, api.NewNotFoundError("blob expired")
Copy link
Contributor

Choose a reason for hiding this comment

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

should we use the same error message as L723?
Users may be relying on the error message to handle different failure cases

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I was wondering about this. I'll change it back for now, but we should probably revisit error message stability in the future.

}

// Check throughout rate limit
blobSize := encoding.GetBlobSize(blobMetadata.ConfirmationInfo.BlobCommitment.Length)

Expand Down
Loading