diff --git a/backend/src/plugins/scheduler.js b/backend/src/plugins/scheduler.js index 553eebc..0e2a1be 100644 --- a/backend/src/plugins/scheduler.js +++ b/backend/src/plugins/scheduler.js @@ -4,6 +4,7 @@ import bots from '../config/bots.js'; import { syncWithRetry, getVersion } from '../services/meilisearch/index.js'; const REDIS_PREFIX = 'bot:status:'; +const TIMEZONE = 'Asia/Seoul'; async function schedulerPlugin(fastify, opts) { const tasks = new Map(); @@ -60,7 +61,7 @@ async function schedulerPlugin(fastify, opts) { const CHECK_INTERVAL = 60 * 1000; // 1분 const CHECK_DURATION = 5 * 60 * 1000; // 5분간 체크 - // 체크 시작 cron (매일 4시) + // 체크 시작 cron (매일 4시 KST) const task = cron.schedule(bot.cron, async () => { fastify.log.info(`[${botId}] 버전 체크 시작 (5분간 1분 간격)`); await updateStatus(botId, { status: 'running' }); @@ -114,7 +115,7 @@ async function schedulerPlugin(fastify, opts) { await performSync(botId, currentVersion, REDIS_VERSION_KEY); } }, CHECK_INTERVAL); - }); + }, { timezone: TIMEZONE }); tasks.set(botId, task); await updateStatus(botId, { status: 'running' }); @@ -202,7 +203,7 @@ async function schedulerPlugin(fastify, opts) { throw new Error(`지원하지 않는 봇 타입: ${bot.type}`); } - // cron 태스크 등록 + // cron 태스크 등록 (한국 시간 기준) const task = cron.schedule(bot.cron, async () => { fastify.log.info(`[${botId}] 동기화 시작`); try { @@ -217,7 +218,7 @@ async function schedulerPlugin(fastify, opts) { }); fastify.log.error(`[${botId}] 동기화 오류: ${err.message}`); } - }); + }, { timezone: TIMEZONE }); tasks.set(botId, task); await updateStatus(botId, { status: 'running' }); diff --git a/backend/src/routes/admin/bots.js b/backend/src/routes/admin/bots.js index 514b1d7..5bd1e2c 100644 --- a/backend/src/routes/admin/bots.js +++ b/backend/src/routes/admin/bots.js @@ -67,7 +67,7 @@ export default async function botsRoutes(fastify) { checkInterval = parseInt(cronMatch[1]); } - result.push({ + const botData = { id: bot.id, name: bot.name || bot.channelName || bot.username || bot.id, type: bot.type, @@ -78,7 +78,15 @@ export default async function botsRoutes(fastify) { check_interval: checkInterval, error_message: status.errorMessage, enabled: bot.enabled, - }); + }; + + // Meilisearch 봇인 경우 버전 정보 추가 + if (bot.type === 'meilisearch') { + const version = await redis.get('meilisearch:version'); + botData.version = version || '-'; + } + + result.push(botData); } return result; diff --git a/frontend/src/components/pc/admin/bot/BotCard.jsx b/frontend/src/components/pc/admin/bot/BotCard.jsx index 4df22f4..2cb80a2 100644 --- a/frontend/src/components/pc/admin/bot/BotCard.jsx +++ b/frontend/src/components/pc/admin/bot/BotCard.jsx @@ -145,14 +145,28 @@ const BotCard = memo(function BotCard({ {bot.type === 'meilisearch' ? ( <>
-
{bot.schedules_added || 0}
-
동기화 수
+
+ {bot.last_check_at + ? new Date(bot.last_check_at).toLocaleString('ko-KR', { + month: 'numeric', + day: 'numeric', + hour: '2-digit', + minute: '2-digit', + hour12: false, + }) + : '-'} +
+
마지막 동기화
- {bot.last_added_count ? `${(bot.last_added_count / 1000 || 0).toFixed(1)}초` : '-'} + {bot.last_added_count?.toLocaleString() || '-'}
-
소요 시간
+
동기화 수
+
+
+
{bot.version || '-'}
+
버전
) : ( @@ -169,12 +183,12 @@ const BotCard = memo(function BotCard({
마지막
+
+
{formatInterval(bot.check_interval)}
+
업데이트 간격
+
)} -
-
{formatInterval(bot.check_interval)}
-
업데이트 간격
-
{/* 오류 메시지 */}