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

Adds single cache for type resolvers (avoid duplication) #64

Merged
merged 2 commits into from
Jun 1, 2023

Conversation

eMaringolo
Copy link
Contributor

When you use a FilteredTypeResolver, e.g. with Animal as the root class with Dog and Cat as different types, if you read by looking at Dog and then look by looking at Animal (e.g. session read: Animal), you'll end up with two different instances stored in two different caches (one for Animal and another one for Dog).

This change removes that duplication, and always uses the root descriptor class for the cache of all the inherited instances.

It's old code I'm merging in order to catch up with the main codebase, the discussion comes from here:
https://groups.google.com/g/glorp-group/c/eccmfOergeY/m/OEHmWD-cDgAJ

I've been using it in production since many years now, and all the Glorp test suite pass with this modification in.

Copy link
Contributor

@tblanchard tblanchard left a comment

Choose a reason for hiding this comment

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

Looks straight forward. Thanks for the contribution.

@gcotelli
Copy link
Member

Some of the integration tests are failing with:
MessageNotUnderstood: receiver of "typeResolver" is nil

@codecov
Copy link

codecov bot commented Apr 11, 2023

Codecov Report

Merging #64 (7b5e681) into master (01bee39) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #64      +/-   ##
==========================================
+ Coverage   77.81%   77.82%   +0.01%     
==========================================
  Files         467      467              
  Lines       48198    48218      +20     
==========================================
+ Hits        37504    37527      +23     
+ Misses      10694    10691       -3     
Impacted Files Coverage Δ
src/Glorp/CacheManager.class.st 91.42% <100.00%> (+0.45%) ⬆️
src/Glorp/FilteredTypeMapping.class.st 92.10% <100.00%> (+0.32%) ⬆️
src/Glorp/RelationExpression.class.st 86.47% <100.00%> (+0.22%) ⬆️

... and 1 file with indirect coverage changes

@eMaringolo
Copy link
Contributor Author

Some of the integration tests are failing with: MessageNotUnderstood: receiver of "typeResolver" is nil

It was weird, but I solved it now. The tests pass UndefinedObject as the argument (aClass) and such class doesn't have a descriptor, so no typeResolver either.

@eMaringolo eMaringolo mentioned this pull request Jun 1, 2023
@gcotelli gcotelli merged commit 2ed0aff into pharo-rdbms:master Jun 1, 2023
30 checks passed
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

3 participants