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

[DEVEX-2333]: Implement caching using dynamo #183

Merged
merged 27 commits into from
Feb 10, 2025

Conversation

MaeIsBad
Copy link
Member

@MaeIsBad MaeIsBad commented Jan 28, 2025

https://prima-assicurazioni-spa.myjetbrains.com/youtrack/issue/DEVEX-2333

I guess this is done. Idk I'm tired of this library, I don't wanna touch it anymore

@MaeIsBad MaeIsBad force-pushed the DEVEX-2333/task/implement-caching-using-dynamo branch from 32f1a3f to 1b53bae Compare February 5, 2025 22:38
@MaeIsBad MaeIsBad marked this pull request as ready for review February 6, 2025 18:10
@MaeIsBad MaeIsBad requested a review from a team as a code owner February 6, 2025 18:10
Copy link
Contributor

@cpiemontese cpiemontese left a comment

Choose a reason for hiding this comment

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

Added a first batch of comments (mainly typos). I like the idea of returning a RefreshingToken and then having all the logic there

I have yet to understand how the various kinds of caches are configured but nice work 👏

Cargo.toml Show resolved Hide resolved
Cargo.toml Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
src/auth0/cache/dynamodb.rs Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Dumb question: what if the users create the table themselves but the key is not called key and the value is not token?

Copy link
Member Author

Choose a reason for hiding this comment

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

Stuff breaks. I guess we can document the table setup?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes! I would absolutely do that then

Copy link
Member Author

Choose a reason for hiding this comment

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

Done to the best of my ability. I don't know that much about aws though

src/auth0/client.rs Outdated Show resolved Hide resolved
src/auth0/util.rs Outdated Show resolved Hide resolved
Comment on lines +30 to +36
let redis_conn = config.cache_type().redis_connection_url().to_string();
let encryption_key = config.token_encryption_key().to_string();
Box::new(
cache::RedisCache::new(redis_conn, encryption_key)
.await
.map_err(Into::<CacheError>::into)?,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I got lost in the code but why does this default to the RedisCache? Backwards compatibility...?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, that's what we did before

MaeIsBad and others added 4 commits February 7, 2025 10:27
Co-authored-by: Cristiano Piemontese <cristiano.piemontese@prima.it>
Co-authored-by: Cristiano Piemontese <cristiano.piemontese@prima.it>
Co-authored-by: Cristiano Piemontese <cristiano.piemontese@prima.it>
@MaeIsBad MaeIsBad force-pushed the DEVEX-2333/task/implement-caching-using-dynamo branch from 82e39e7 to 577bf47 Compare February 7, 2025 09:42
emilianobovetti
emilianobovetti previously approved these changes Feb 7, 2025
@cpiemontese cpiemontese self-requested a review February 7, 2025 11:52
Copy link
Contributor

@cpiemontese cpiemontese left a comment

Choose a reason for hiding this comment

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

Should we put the redis cache behind a feature flag (on by default)? 🤔

Aside from that, the only thing I would do is add a bit of examples in the docs of how to configure the various caches or in general document this as much as possible

@MaeIsBad
Copy link
Member Author

MaeIsBad commented Feb 7, 2025

Should we put the redis cache behind a feature flag (on by default)? 🤔

doing that without breaking backwards compat is really weird and I don't really wanna think about it

Aside from that, the only thing I would do is add a bit of examples in the docs of how to configure the various caches or in general document this as much as possible

Would you mind if we made that a separate task? I think the documentation on docs.rs makes these features fairly easy to discover and I've spent so much time on this card that I'd really like to just get it done

@MaeIsBad MaeIsBad requested a review from cpiemontese February 7, 2025 14:59
cpiemontese
cpiemontese previously approved these changes Feb 7, 2025
Copy link
Contributor

@cpiemontese cpiemontese left a comment

Choose a reason for hiding this comment

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

Completely fine with the code docs and eventually tackling this in a separate card 🚀

@MaeIsBad MaeIsBad merged commit 2174683 into master Feb 10, 2025
7 checks passed
@MaeIsBad MaeIsBad deleted the DEVEX-2333/task/implement-caching-using-dynamo branch February 10, 2025 14:28
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.

3 participants