@@ -166,32 +166,37 @@ export default function serve() {
166166 if ( produce_cron ) {
167167 $ . info ( `[PRODUCE CRON] ${ produce_cron } enabled` ) ;
168168 const { CronJob } = eval ( `require("cron")` ) ;
169- produce_cron . split ( / \s * ; \s * / ) . map ( ( item ) => {
170- const [ cron , type , name ] = item . split ( / \s * , \s * / ) ;
171- new CronJob (
172- cron . trim ( ) ,
173- async function ( ) {
174- try {
175- $ . info (
176- `[PRODUCE CRON] ${ type } ${ name } ${ cron } started` ,
177- ) ;
178- await produceArtifact ( { type, name } ) ;
179- $ . info (
180- `[PRODUCE CRON] ${ type } ${ name } ${ cron } finished` ,
181- ) ;
182- } catch ( e ) {
183- $ . error (
184- `[PRODUCE CRON] ${ type } ${ name } ${ cron } error: ${
185- e . message ?? e
186- } `,
187- ) ;
188- }
189- } , // onTick
190- null , // onComplete
191- true , // start
192- // 'Asia/Shanghai' // timeZone
193- ) ;
194- } ) ;
169+ produce_cron
170+ . split ( / \s * ; \s * / )
171+ . map ( ( item ) => item . trim ( ) )
172+ . filter ( ( item ) => item . length > 0 )
173+ . forEach ( ( item ) => {
174+ const [ cron , type , name ] = item . split ( / \s * , \s * / ) ;
175+ $ . info ( `[PRODUCE CRON] ${ type } ${ name } ${ cron } scheduled` ) ;
176+ new CronJob (
177+ cron . trim ( ) ,
178+ async function ( ) {
179+ try {
180+ $ . info (
181+ `[PRODUCE CRON] ${ type } ${ name } ${ cron } started` ,
182+ ) ;
183+ await produceArtifact ( { type, name } ) ;
184+ $ . info (
185+ `[PRODUCE CRON] ${ type } ${ name } ${ cron } finished` ,
186+ ) ;
187+ } catch ( e ) {
188+ $ . error (
189+ `[PRODUCE CRON] ${ type } ${ name } ${ cron } error: ${
190+ e . message ?? e
191+ } `,
192+ ) ;
193+ }
194+ } , // onTick
195+ null , // onComplete
196+ true , // start
197+ // 'Asia/Shanghai' // timeZone
198+ ) ;
199+ } ) ;
195200 }
196201 const backend_download_cron = eval (
197202 'process.env.SUB_STORE_BACKEND_DOWNLOAD_CRON' ,
0 commit comments