File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -80,13 +80,20 @@ function encode(text) {
8080}
8181
8282async function callback ( ) {
83- const posts = await Post
84- . find ( {
85- status : 'publish' ,
86- mp3 : { $exists : true } ,
87- } )
88- . sort ( { date : - 1 } )
89- . lean ( ) ;
83+ // const posts = await Post
84+ // .find({
85+ // status: 'publish',
86+ // mp3: { $exists: true },
87+ // })
88+ // .sort({ date: -1 })
89+ // .lean();
90+
91+ const posts = await Post . find ( ) . where ( 'status' ) . equals ( 'publish' ) . lean ( ) ;
92+
93+ // mongoose sort is slower
94+ posts . sort ( ( o1 , o2 ) => {
95+ return o1 . date >= o2 . date ? - 1 : 1 ;
96+ } ) ;
9097
9198 const publicFeedAllConfig = cloneDeep ( rawFeedConfig ) ;
9299 const publicFeedConfig = cloneDeep ( rawFeedConfig ) ;
@@ -101,6 +108,8 @@ async function callback() {
101108 posts . forEach ( ( post ) => {
102109 episode -= 1 ;
103110
111+ if ( ! post . mp3 ) return ; // missing mp3 breaks the rss list
112+
104113 let description ;
105114
106115 const extractedDescription = post . excerpt . rendered . match ( / D o w n l o a d ( .* ?) [ < ] / ) || post . excerpt . rendered . match ( / [ > ] ( .* ?) [ < ] / ) ;
You can’t perform that action at this time.
0 commit comments