mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-05 23:47:54 +08:00
add run-record-id arg
This commit is contained in:
@@ -23,7 +23,8 @@ import {
|
||||
getCompanyLibrary,
|
||||
getJobLibrary,
|
||||
getJobHistoryByEncryptId,
|
||||
getMarkAsNotSuitRecord
|
||||
getMarkAsNotSuitRecord,
|
||||
saveAndGetCurrentRunRecord,
|
||||
} from '../utils/db/index'
|
||||
import { PageReq } from '../../../../common/types/pagination'
|
||||
import { pipeWriteRegardlessError } from '../../utils/pipe'
|
||||
@@ -203,6 +204,7 @@ export default function initIpc() {
|
||||
if (!puppeteerExecutable) {
|
||||
return Promise.reject('NEED_TO_CHECK_RUNTIME_DEPENDENCIES')
|
||||
}
|
||||
const currentRunRecord = (await saveAndGetCurrentRunRecord())?.data
|
||||
const subProcessEnv = {
|
||||
...process.env,
|
||||
PUPPETEER_EXECUTABLE_PATH: puppeteerExecutable.executablePath,
|
||||
@@ -219,7 +221,8 @@ export default function initIpc() {
|
||||
command: process.argv[0],
|
||||
args: [
|
||||
process.argv[1],
|
||||
`--mode=geekAutoStartWithBossMain`
|
||||
`--mode=geekAutoStartWithBossMain`,
|
||||
`--run-record-id=${currentRunRecord?.id || 0}`
|
||||
],
|
||||
env: subProcessEnv
|
||||
},
|
||||
@@ -257,6 +260,7 @@ export default function initIpc() {
|
||||
if (!puppeteerExecutable) {
|
||||
return Promise.reject('NEED_TO_CHECK_RUNTIME_DEPENDENCIES')
|
||||
}
|
||||
const currentRunRecord = (await saveAndGetCurrentRunRecord())?.data
|
||||
const subProcessEnv = {
|
||||
...process.env,
|
||||
PUPPETEER_EXECUTABLE_PATH: puppeteerExecutable.executablePath,
|
||||
@@ -273,7 +277,8 @@ export default function initIpc() {
|
||||
command: process.argv[0],
|
||||
args: [
|
||||
process.argv[1],
|
||||
`--mode=readNoReplyAutoReminder`
|
||||
`--mode=readNoReplyAutoReminder`,
|
||||
`--run-record-id=${currentRunRecord?.id || 0}`
|
||||
],
|
||||
env: subProcessEnv
|
||||
},
|
||||
|
||||
@@ -102,3 +102,10 @@ export const getJobHistoryByEncryptId = async (encryptJobId) => {
|
||||
})
|
||||
return res
|
||||
}
|
||||
|
||||
export const saveAndGetCurrentRunRecord = async () => {
|
||||
const res = await createWorkerPromise({
|
||||
type: 'saveAndGetCurrentRunRecord'
|
||||
})
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import { VMarkAsNotSuitLog } from '@geekgeekrun/sqlite-plugin/dist/entity/VMarkA
|
||||
import { measureExecutionTime } from '../../../../../../common/utils/performance'
|
||||
import { PageReq, PagedRes } from '../../../../../../common/types/pagination'
|
||||
import { JobInfoChangeLog } from '@geekgeekrun/sqlite-plugin/dist/entity/JobInfoChangeLog'
|
||||
import { AutoStartChatRunRecord } from '@geekgeekrun/sqlite-plugin/dist/entity/AutoStartChatRunRecord'
|
||||
|
||||
const dbInitPromise = initDb(getPublicDbFilePath())
|
||||
let dataSource: DataSource | null = null
|
||||
@@ -161,6 +162,13 @@ const payloadHandler = {
|
||||
})
|
||||
)
|
||||
return data
|
||||
},
|
||||
async saveAndGetCurrentRunRecord() {
|
||||
const autoStartChatRunRecord = new AutoStartChatRunRecord()
|
||||
autoStartChatRunRecord.date = new Date()
|
||||
const autoStartChatRunRecordRepository = dataSource!.getRepository(AutoStartChatRunRecord)
|
||||
const result = await autoStartChatRunRecordRepository.save(autoStartChatRunRecord)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user