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

configurable sessions expiration #1501

Merged
merged 2 commits into from
Dec 18, 2023
Merged

Conversation

rpassas
Copy link
Member

@rpassas rpassas commented Nov 28, 2023

Summary

Original thread here. I didn't refactor SessionCache into an interface, but I'm happy to do so while we're looking at it.

This is meant to be a simple addition to allow the wrapper to create a ValidationService with a configurable SessionCache. That is, when resetExpirationAfterAccess is true, an active session's expiration time resets when it is accessed.

Copy link

codecov bot commented Nov 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (161e92d) 11.63% compared to head (bdec0db) 11.65%.
Report is 52 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1501      +/-   ##
============================================
+ Coverage     11.63%   11.65%   +0.01%     
- Complexity    30029    30092      +63     
============================================
  Files          2154     2157       +3     
  Lines        665568   665830     +262     
  Branches     196667   196744      +77     
============================================
+ Hits          77464    77571     +107     
- Misses       559891   560024     +133     
- Partials      28213    28235      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dotasek
Copy link
Collaborator

dotasek commented Nov 29, 2023

The implementation seems simple and reasonable, but I'd like to see a few things happen:

  1. The new behaviour needs some unit tests. There are some already written that you can probably copy and alter to be appropriate: https://github.com/hapifhir/org.hl7.fhir.core/blob/master/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/services/SessionCacheTest.java

  2. I really would like SessionCache to be an interface, and for this to be a PassiveExpiringSessionCache implementation of that.

  3. Could we make setExpirationAfterAccess fluent? So we can just call SessionCache sessionCache = new SessionCache(...).setExpirationAfterAccess(true)

@dotasek dotasek self-requested a review November 29, 2023 20:38
Copy link
Collaborator

@dotasek dotasek left a comment

Choose a reason for hiding this comment

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

See comments for requested changes.

@dotasek
Copy link
Collaborator

dotasek commented Dec 11, 2023

Thank you for the refactor @rpassas. There is a failing test on Azure pipelines: https://dev.azure.com/fhir-pipelines/fhir-core-library/_build/results?buildId=16210&view=logs&j=7448d812-dbed-5970-799b-77d1cf827579&t=5ba38598-e9de-532c-87f1-57d0b28805df

I will investigate why that is, and review the test in the process.

I also see that the interface you created has methods that are directly bound to the expiring cache implementation. I'm going to create a branch that separates the two that can be merged into this.

@dotasek
Copy link
Collaborator

dotasek commented Dec 11, 2023

@rpassas Please check these two branches.

https://github.com/hapifhir/org.hl7.fhir.core/tree/do-20231211-sessionCache-reset-on-fetch
https://github.com/hapifhir/org.hl7.fhir.validator-wrapper/tree/do-20231211-sessionCache-reset-on-fetch

Your test was nearly correct; I repaired it. I made some of the methods have more explicit meaning, and moved some methods to the implementation. Let me know if these changes work for you; I'd like to see them merged into your PRs before merging them to master/main.

@rpassas
Copy link
Member Author

rpassas commented Dec 15, 2023

@rpassas Please check these two branches.

https://github.com/hapifhir/org.hl7.fhir.core/tree/do-20231211-sessionCache-reset-on-fetch https://github.com/hapifhir/org.hl7.fhir.validator-wrapper/tree/do-20231211-sessionCache-reset-on-fetch

Your test was nearly correct; I repaired it. I made some of the methods have more explicit meaning, and moved some methods to the implementation. Let me know if these changes work for you; I'd like to see them merged into your PRs before merging them to master/main.

@dotasek I've merged your requested changes (in the wrapper as well). They all look good to me - thanks!

@dotasek dotasek merged commit f9e7f98 into hapifhir:master Dec 18, 2023
33 checks passed
@rpassas rpassas deleted the sessionCacheReset branch December 19, 2023 15:50
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.

None yet

2 participants