게시물 가져오기 작업 센터 추가
This commit is contained in:
22
server/plugins/post-import-worker.js
Normal file
22
server/plugins/post-import-worker.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Cron } from 'croner'
|
||||
import { queuePendingPostImportJobs } from '../repositories/post-import-repository'
|
||||
|
||||
const queuePostImportWork = async () => {
|
||||
try {
|
||||
await queuePendingPostImportJobs()
|
||||
} catch (error) {
|
||||
console.error('[post-import] 작업 복구 확인 실패', error)
|
||||
}
|
||||
}
|
||||
|
||||
export default defineNitroPlugin(() => {
|
||||
if (process.env.NUXT_POST_IMPORT_WORKER === '0' || process.env.PLAYWRIGHT_TEST === '1') {
|
||||
return
|
||||
}
|
||||
|
||||
queuePostImportWork()
|
||||
|
||||
new Cron('*/15 * * * * *', {
|
||||
protect: true
|
||||
}, queuePostImportWork)
|
||||
})
|
||||
Reference in New Issue
Block a user