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