-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix: prevent coauthors capability check infinite loop #46
Conversation
Nice catch! But will this make the posts included in the newsletters to not display the filtered by lines? Did you figure out why exactly this causes an OOM? |
Ah. I'm not sure. TBH I'm not very familiar with co-authors plus and haven't really set it up to test properly. But will try setting up and confirming today.
It looks like there might be an infinite loop triggered when filtering coauthors via our network customization. It looks like in the process of creating the distributor post for the newsletter, co-authors plus triggers the |
That is a pretty common way of ending up with infinite loops (circular hooks). Good sleuthing! |
@leogermani, I've set up and tested this and it looks like distributed, coauthored posts still appear with the expected by lines. Here are the inserted posts from a test email sent to myself: I'm not sure if this covers all of the expected cases, or if this is exactly what you were referring to. Let me know if I'm off base. |
For informational purposes, after @leogermani pointed out an issue with guest authors with this approach, I did some more digging into the exact problem here.
|
Yay! Thanks for catching this @chickenn00dle ! So good when these things are surfaced. It seems the only reason we are using a Ideally by using a method provided by Distributor. But if not possible, by reading the data directly (I guess it's a post meta) |
8276b43
to
ac1eb9a
Compare
ac1eb9a
to
e080ed8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Phenomenal
# [1.2.0-alpha.2](v1.2.0-alpha.1...v1.2.0-alpha.2) (2024-02-15) ### Bug Fixes * assorted error handling fixes ([#52](#52)) ([234f883](234f883)) * dynamic class property deprecated warnings ([#47](#47)) ([693865c](693865c)) * prevent coauthors capability check infinite loop ([#46](#46)) ([9565cef](9565cef)) * set Yoast primary category ([#41](#41)) ([3457d19](3457d19)) ### Features * sync billing and shipping addresses ([#50](#50)) ([6a05580](6a05580)) * sync publish, trash post statuses ([#42](#42)) ([fd5d8b9](fd5d8b9))
🎉 This PR is included in version 1.2.0-alpha.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
# [1.2.0](v1.1.0...v1.2.0) (2024-02-20) ### Bug Fixes * assorted error handling fixes ([#52](#52)) ([234f883](234f883)) * **data-listeners:** handle no user in wc data update ([4eeefc0](4eeefc0)) * dynamic class property deprecated warnings ([#47](#47)) ([693865c](693865c)) * prevent coauthors capability check infinite loop ([#46](#46)) ([9565cef](9565cef)) * race condition when creating a Node ([1946473](1946473)) * set Yoast primary category ([#41](#41)) ([3457d19](3457d19)) ### Features * **ci:** add epic/* release workflow and rename `master` to `trunk` ([#39](#39)) ([9cee51d](9cee51d)) * sync billing and shipping addresses ([#50](#50)) ([6a05580](6a05580)) * sync publish, trash post statuses ([#42](#42)) ([fd5d8b9](fd5d8b9))
🎉 This PR is included in version 1.2.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Closes
0/1206331646877116/1206535636784422/f
This fixes an issue where, when NP Network, Distributor, CAP, and NP Newsletters are active, sending a newsletters causes an infinite capability check which results in a fatal memory error.
The issue happens because we are creating a Distributor Post object to check a distributed posts linked status when filtering coauthors via the
get_coauthors
hook. But this same hook is eventually triggered in the instantiation of the Distributor Post object.This PR fixes this by checking a posts linked status directly via post meta.
Testing steps