@@ -115,9 +115,12 @@ async function handler(ctx) {
115115
116116 const data = response . statuses . filter ( ( s ) => s . mark !== 1 ) ; // 去除置顶动态
117117
118- const items = await Promise . all (
119- data . map ( ( item ) =>
120- cache . tryGet ( item . target , async ( ) => {
118+ // Serial execution avoids concurrency-triggered rate limiting on show.json.
119+ const items = [ ] ;
120+ /* eslint-disable no-await-in-loop */
121+ for ( const item of data ) {
122+ try {
123+ items . push ( await cache . tryGet ( item . target , async ( ) => {
121124 // legal_user_visible 为 true 时列表已含完整内容,无需再请求详情
122125 if ( item . legal_user_visible ) {
123126 return buildListItem ( item ) ;
@@ -140,12 +143,22 @@ async function handler(ctx) {
140143 pubDate : parseDate ( item . created_at ) ,
141144 link : rootUrl + item . target ,
142145 } ;
143- } catch {
144- return buildListItem ( item ) ;
146+ } catch ( error : any ) {
147+ // Permanent failures (post deleted / not found): cache the fallback.
148+ const data = error . response ?. _data || error . data ;
149+ if ( data && typeof data === 'object' && data . error_code ) {
150+ return buildListItem ( item ) ;
151+ }
152+ // Transient failures (rate limit / WAF): throw to skip caching, retry next request.
153+ throw error ;
145154 }
146155 } )
147- )
148- ) ;
156+ ) ;
157+ } catch {
158+ items . push ( buildListItem ( item ) ) ;
159+ }
160+ }
161+ /* eslint-enable no-await-in-loop */
149162
150163 const user = data [ 0 ] ?. user ;
151164
0 commit comments