addons icon indicating copy to clipboard operation
addons copied to clipboard

FeedDiscussions: add cronjob-compatible trigger

Open DivineDominion opened this issue 4 years ago • 0 comments

Debugging the plugin, I noticed that I had to create a post/discussion in order to make FeedDiscussions update its stuff.

While that does indeed reduce the overhead compared to, say, trying that for every request, I find this to be less useful to auto-populate discussions from RSS feeds. Because if your few members don't write anything, they don't get to read new stuff to comment on.

I found that I could trigger a fetch using curl when I passed all the HTTP GET request header, including the cookie.

For more details, I asked in the forums first: https://open.vanillaforums.com/discussion/38906/feed-discussions-how-to-reliably-trigger-a-fetch-of-feeds

The weird thing is that I do indeed get a 201 Created response for the /plugin/feeddiscussions endpoint every now and then (this is tied to the update interval), but no actual discussion is being created in the process. I tried this with http://lorem-rss.herokuapp.com/ set at a sub-minute interval. Feed items are discarded from curl requests unless I add cookie information.

I believe some of the conditions during pollFeed are aborting early; e.g. somewhere after here: https://github.com/vanilla/addons/blob/master/plugins/FeedDiscussions/class.feeddiscussions.plugin.php#L352

But it's quite hard to debug this. I don't know enough of the event system and the conditions here.

Side note: I also think the if (!$this->EventArguments['Publish']) condition in particular is superfluos because this argument is being set to true a couple lines above? Not sure if it's changed somewhere else though.

Help by you experts would be much appreciated! :)

DivineDominion avatar Oct 16 '21 11:10 DivineDominion