Correct promise order in RSS feed generator#9726
Conversation
uqee
commented
Jul 9, 2018
- the 'rss.feed' filter used to get an empty feed as a parameter, because item generation is done via promises
- now it waits until all items have been added
no issue - the 'rss.feed' filter used to get an empty feed as a parameter, because item generation is done via promises - now it waits until all items have been added
| filters.doFilter('rss.item', item, post).then(function then(item) { | ||
| feed.item(item); | ||
| return Promise.all( | ||
| data.posts.map(function map(post) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
kirrg001
left a comment
There was a problem hiding this comment.
Thanks for the PR 👍
I left one comment https://github.com/TryGhost/Ghost/pull/9726/files#r201314618 for discussion :)
no issue The posts are provided in a specific order, which should be preserved in a corresponding sequence of promises.
|
Local |
|
I have restarted the build 👍 |
|
Awesome! Any more suggestions? |
| feed.item(item); | ||
| return data.posts.reduce(function (feedPromise, post) { | ||
| return feedPromise.then(function () { | ||
| var item = generateItem(post, siteUrl, data.secure); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
| return feed.item(item); | ||
| }); | ||
| }); | ||
| }, Promise.resolve()).then(function () { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
| filters.doFilter('rss.item', item, post).then(function then(item) { | ||
| feed.item(item); | ||
| }); | ||
| const {urlFor} = urlService.utils; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
Restart it, please. |
no issue - the 'rss.feed' filter used to get an empty feed as a parameter, because item generation is done via promises - now it waits until all items have been added