Skip to content

Conversation

jaesivsm
Copy link
Contributor

Only triggering _mark_as_changed on DictField if the value is actually
changed.

Limit the number of field accumulated in _changed_fields.

@bagerard
Copy link
Collaborator

Change is valid but I'm curious, how did you noticed it @jaesivsm ?

@jaesivsm
Copy link
Contributor Author

Well it's a bit complex to describe without going in the specifics but I'm gonna try x)

We have a model with a field that gets set some values that shouldn't trigger a _mark_as_changed (because it's the same value). That's the issue this patch fixes.
We also have function connected through a signal that checks Document._delta (I know it's not a "public" API :/ sorry) to list the field that were changed right before the db write. Depending of the field that were changed it'll trigger various stuff. That last part was the visible symptom.

@jaesivsm jaesivsm force-pushed the fix/mark-dict-field-as-dirty branch from 053c6b8 to 0ec7503 Compare March 31, 2022 08:41
jaesivsm added 2 commits May 15, 2022 20:23
Only triggering `_mark_as_changed` on DictField if the value is actually
changed.
@jaesivsm jaesivsm force-pushed the fix/mark-dict-field-as-dirty branch from 0ec7503 to 29693bc Compare May 15, 2022 18:23
@jaesivsm
Copy link
Contributor Author

Hello @bagerard, do you think it would be possible to integrate that in the next release ?

@bagerard bagerard merged commit 4687aff into MongoEngine:master Feb 25, 2023
@jaesivsm jaesivsm deleted the fix/mark-dict-field-as-dirty branch February 27, 2023 09:45
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.

2 participants