mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修复定时任务 real_time 参数,升级 protobufjs
This commit is contained in:
parent
70f2bef5d2
commit
07541569c5
|
@ -435,7 +435,10 @@ export default class CronService {
|
|||
const logPath = `${uniqPath}/${logTime}.log`;
|
||||
const absolutePath = path.resolve(config.logPath, `${logPath}`);
|
||||
const cp = spawn(
|
||||
`real_log_path=${logPath} real_time=true no_delay=true ${this.makeCommand(cron)}`,
|
||||
`real_log_path=${logPath} no_delay=true ${this.makeCommand(
|
||||
cron,
|
||||
true
|
||||
)}`,
|
||||
{ shell: '/bin/bash' },
|
||||
);
|
||||
|
||||
|
@ -526,12 +529,14 @@ export default class CronService {
|
|||
}
|
||||
}
|
||||
|
||||
private makeCommand(tab: Crontab) {
|
||||
private makeCommand(tab: Crontab, realTime?: boolean) {
|
||||
let command = tab.command.trim();
|
||||
if (!command.startsWith(TASK_PREFIX) && !command.startsWith(QL_PREFIX)) {
|
||||
command = `${TASK_PREFIX}${tab.command}`;
|
||||
}
|
||||
let commandVariable = `no_tee=true ID=${tab.id} `;
|
||||
let commandVariable = `real_time=${Boolean(realTime)} no_tee=true ID=${
|
||||
tab.id
|
||||
} `;
|
||||
if (tab.task_before) {
|
||||
commandVariable += `task_before='${tab.task_before
|
||||
.replace(/'/g, "'\\''")
|
||||
|
|
|
@ -13,7 +13,7 @@ import taskLimit from '../shared/pLimit';
|
|||
import { spawn } from 'cross-spawn';
|
||||
|
||||
export interface ScheduleTaskType {
|
||||
id: number;
|
||||
id?: number;
|
||||
command: string;
|
||||
name?: string;
|
||||
schedule?: string;
|
||||
|
|
|
@ -91,9 +91,9 @@ export default class SubscriptionService {
|
|||
this.taskCallbacks(doc),
|
||||
runImmediately,
|
||||
));
|
||||
} else {
|
||||
} else if (doc.interval_schedule) {
|
||||
this.scheduleService.cancelIntervalTask(doc as any);
|
||||
const { type, value } = doc.interval_schedule as any;
|
||||
const { type, value } = doc.interval_schedule;
|
||||
needCreate &&
|
||||
(await this.scheduleService.createIntervalTask(
|
||||
doc as any,
|
||||
|
@ -256,7 +256,7 @@ export default class SubscriptionService {
|
|||
);
|
||||
}
|
||||
|
||||
public async remove(ids: number[], query: any) {
|
||||
public async remove(ids: number[], query: { force?: boolean }) {
|
||||
const docs = await SubscriptionModel.findAll({ where: { id: ids } });
|
||||
for (const doc of docs) {
|
||||
await this.handleTask(doc, false);
|
||||
|
@ -279,8 +279,11 @@ export default class SubscriptionService {
|
|||
public async getDb(
|
||||
query: FindOptions<Subscription>['where'],
|
||||
): Promise<Subscription> {
|
||||
const doc: any = await SubscriptionModel.findOne({ where: { ...query } });
|
||||
return doc && (doc.get({ plain: true }) as Subscription);
|
||||
const doc = await SubscriptionModel.findOne({ where: { ...query } });
|
||||
if (!doc) {
|
||||
throw new Error(`${JSON.stringify(query)} not found`);
|
||||
}
|
||||
return doc.get({ plain: true });
|
||||
}
|
||||
|
||||
public async run(ids: number[]) {
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
"node-schedule": "^2.1.0",
|
||||
"nodemailer": "^6.7.2",
|
||||
"p-queue-cjs": "7.3.4",
|
||||
"protobufjs": "^7.2.3",
|
||||
"protobufjs": "^7.3.0",
|
||||
"pstree.remy": "^1.1.8",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"sequelize": "^6.25.5",
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
lockfileVersion: '6.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
dependencies:
|
||||
'@grpc/grpc-js':
|
||||
specifier: ^1.8.13
|
||||
|
@ -89,8 +93,8 @@ dependencies:
|
|||
specifier: 7.3.4
|
||||
version: 7.3.4
|
||||
protobufjs:
|
||||
specifier: ^7.2.3
|
||||
version: 7.2.3
|
||||
specifier: ^7.3.0
|
||||
version: 7.3.0
|
||||
pstree.remy:
|
||||
specifier: ^1.1.8
|
||||
version: 1.1.8
|
||||
|
@ -3930,7 +3934,7 @@ packages:
|
|||
'@types/long': 4.0.2
|
||||
lodash.camelcase: 4.3.0
|
||||
long: 4.0.0
|
||||
protobufjs: 7.2.3
|
||||
protobufjs: 7.3.0
|
||||
yargs: 17.7.2
|
||||
dev: false
|
||||
|
||||
|
@ -7386,7 +7390,7 @@ packages:
|
|||
normalize-path: 3.0.0
|
||||
readdirp: 3.6.0
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.2
|
||||
fsevents: 2.3.3
|
||||
|
||||
/chownr@2.0.0:
|
||||
resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==}
|
||||
|
@ -9360,19 +9364,11 @@ packages:
|
|||
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
|
||||
requiresBuild: true
|
||||
|
||||
/fsevents@2.3.2:
|
||||
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
|
||||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/fsevents@2.3.3:
|
||||
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
|
||||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/ftp@0.3.10:
|
||||
|
@ -12834,8 +12830,8 @@ packages:
|
|||
long: 4.0.0
|
||||
dev: true
|
||||
|
||||
/protobufjs@7.2.3:
|
||||
resolution: {integrity: sha512-TtpvOqwB5Gdz/PQmOjgsrGH1nHjAQVCN7JG4A6r1sXRWESL5rNMAiRcBQlCAdKxZcAbstExQePYG8xof/JVRgg==}
|
||||
/protobufjs@7.3.0:
|
||||
resolution: {integrity: sha512-YWD03n3shzV9ImZRX3ccbjqLxj7NokGN0V/ESiBV5xWqrommYHYiihuIyavq03pWSGqlyvYUFmfoMKd+1rPA/g==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
|
@ -16673,7 +16669,3 @@ packages:
|
|||
- encoding
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
|
Loading…
Reference in New Issue
Block a user