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