feat: add comfort user

This commit is contained in:
2025-06-30 01:59:26 +08:00
parent 42da851c37
commit 143cbc877c
8 changed files with 96 additions and 99 deletions

View File

@@ -6,6 +6,8 @@ import { queue, XHS_QUEUE_NAME, taskApp } from './index.ts';
import { addUnreadTask } from './task.ts';
import dayjs from 'dayjs';
import { getTimeDuration } from './utils/time.ts';
import { config, isDev } from '../modules/config.ts';
export const sleep = (ms: number) => {
return new Promise((resolve) => setTimeout(resolve, ms));
};
@@ -102,10 +104,11 @@ worker.on('completed', async (job) => {
// console.log('======has jobs, no need to add new job');
} else {
const up = timeRecorder.getClampDuration(true);
const nextTime = up.nextTime + getTimeDuration();
const timeDuration = isDev ? 0 : getTimeDuration();
const nextTime = up.nextTime + timeDuration;
const unread = await queue.getJob('unread');
if (!unread) {
console.log('====add unread next-time', nextTime, getTimeDuration());
console.log('====add unread next-time', nextTime, timeDuration);
addUnreadTask(nextTime);
}
}