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

identity/redisdir: various fixes #534

Merged
merged 17 commits into from
Oct 7, 2024
Merged

Conversation

bnewbold
Copy link
Collaborator

@bnewbold bnewbold commented Jan 25, 2024

A bunch of cleanups and bug fixes.

The biggest fix is to apply a bug fix from the cache directory resulting in "nil/nil" responses. These were fixed in #479, but not copied to the redis directory implementation, which has the same coalescing code. This recently impacted @whyrusleeping's use in discover. This is a backwards-compatible fix.

Another fix handles cached error messages. An empty string was being stored for the DID. Because redis cache serializes, and the de-serialized DID is re-parsed, the empty strings fail to parse, resulting in an error. I guess we could consider having text parsing of DIDs not actually parse the string? but that would break auto-validation when it is expected. The fix was to make that field nullable. this might make the change not-backwards-compatible with existing cached metadata? this only impacts cached errors, which have a shorter TTL, so might not be that big of a deal in practice?

Other smaller cleanups and fixes, which rolled in here to make the code align better with the in-memory caching directory, so that merge/review is easier:

  • adds invalid handle TTL to redisdir
  • adds "WithCacheState" variants of methods, for metrics/perf measurement
  • fix deletion/purging
  • special-case handling of resolving invalid handle

One remaining issue is that the cached error types come back as generic errors (with error kind/type striped). It would be nice if that wasn't the case, so that code could detect specific types of errors? Considering doing a manual enum/integer hack to encode the type and convert the errors to the actual type on read, for a small set of known identity errors.

@bnewbold bnewbold marked this pull request as ready for review September 25, 2024 10:43
Copy link
Contributor

@brianolson brianolson left a comment

Choose a reason for hiding this comment

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

I think I get it, mostly improving error handling. same quibble that I prefer errors.New("") when the string doesn't need formatting params

@bnewbold
Copy link
Collaborator Author

Resolved the review things. My disposition is to merge this, but I want to monitor when this gets deployed (in various places), so i'll probably wait until i'm ready to do a controlled deploy and merge it then.

@bnewbold bnewbold changed the title redisdir: handle purge of uncached directory info identity/redisdir: various fixes Oct 3, 2024
@whyrusleeping whyrusleeping merged commit 160af4a into main Oct 7, 2024
7 checks passed
@bnewbold bnewbold deleted the bnewbold/redsdir-fixes branch October 11, 2024 16:24
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.

4 participants