fix(scheduled-task): enable worker by default and add WeChat preflight
Memind CI / Test, build, and release guards (push) Has been cancelled
Memind CI / Test, build, and release guards (push) Has been cancelled
Scheduled automations were saved but never executed because the worker required an explicit env flag. Follow H5_REMINDER_WORKER_ENABLED when unset, add WeChat preflight to write tasks deterministically, and surface worker warnings on create. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import { createPageEditSessionService } from '../mindspace-page-edit-session.mjs
|
||||
import { createNotificationDispatcher } from '../notification-dispatcher.mjs';
|
||||
import { startScheduleReminderWorker } from '../schedule-reminder-worker.mjs';
|
||||
import { startScheduledTaskWorker } from '../scheduled-task-worker.mjs';
|
||||
import { isScheduledTaskWorkerEnabled } from '../scheduled-task-worker-config.mjs';
|
||||
import { isPassiveCanaryRuntime } from './portal-runtime-role.mjs';
|
||||
import { loadWechatMpModule } from '../wechat-mp-loader.mjs';
|
||||
import { createToolGateway } from '../tool-gateway.mjs';
|
||||
@@ -164,6 +165,10 @@ export async function bootstrapPortalIntegrationServices({
|
||||
env.H5_SCHEDULE_ENABLED === '1'
|
||||
? scheduleService
|
||||
: null,
|
||||
scheduledTaskService:
|
||||
env.H5_SCHEDULE_ENABLED === '1'
|
||||
? scheduledTaskService
|
||||
: null,
|
||||
wechatScheduleLlmConfigService,
|
||||
llmProviderService,
|
||||
chatIntentRouter,
|
||||
@@ -277,7 +282,7 @@ export async function bootstrapPortalIntegrationServices({
|
||||
let scheduledTaskWorker = null;
|
||||
if (
|
||||
!isPassiveCanaryRuntime(env) &&
|
||||
env.H5_SCHEDULED_TASK_WORKER_ENABLED === '1' &&
|
||||
isScheduledTaskWorkerEnabled(env) &&
|
||||
scheduledTaskService &&
|
||||
userAuth &&
|
||||
tkmindProxy
|
||||
@@ -295,6 +300,14 @@ export async function bootstrapPortalIntegrationServices({
|
||||
logger,
|
||||
});
|
||||
logger.log('Scheduled task worker enabled');
|
||||
} else if (
|
||||
!isPassiveCanaryRuntime(env)
|
||||
&& scheduledTaskService
|
||||
&& !isScheduledTaskWorkerEnabled(env)
|
||||
) {
|
||||
logger.warn?.(
|
||||
'Scheduled task worker disabled: set H5_SCHEDULED_TASK_WORKER_ENABLED=1 or H5_REMINDER_WORKER_ENABLED=1',
|
||||
);
|
||||
}
|
||||
|
||||
let subscriptionExpiryTimer = null;
|
||||
|
||||
Reference in New Issue
Block a user