Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save michaelhelmick/f026ac1c011a9ef25ba22575b6f57fbc to your computer and use it in GitHub Desktop.
Save michaelhelmick/f026ac1c011a9ef25ba22575b6f57fbc to your computer and use it in GitHub Desktop.
Anybody have experience with a Max Recursion error when using defer?
https://dpaste.org/1o8W -- This code will work as-is, I've ran into a Max Recursion error when __init__ has TWO fields it's trying to access
https://dpaste.org/bdXc -- here is the code that errors, I've removed the comment in Person.__init__ and now there are TWO fields it's trying to access vs ONE
I guess I'm more asking to help understand why ONE vs TWO fields causes the recursion error. I see refresh_from_db getting called and from the docs I've read it makes sense because it does that for the field that it doesn't have (first_name), then in the __init__ it looks like it is calling "only" with the field "has_siblings"
Then looks like it's trying to call refresh_from_db on the second field in the __init__ "suffix" with deferred fields having "has_siblings"
If anybody could confirm that analysis and if this is intended behavior and just poor performance OR if this appears to be an actual bug and I should open a ticket for it?
Here is a profile of what's happening query-wise https://dpaste.org/Sq1d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment