Enhance job state update functionality in DocumentPrinterClient
All checks were successful
farmcontrol/farmcontrol-server/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-server/pipeline/head This commit looks good
- Introduced a `notify` parameter in the `editObject` method of `SocketClient` to control notification behavior during job state updates. - Updated the `updateJobState` method in `DocumentPrinterClient` to conditionally set the `notify` parameter based on the job state type, improving the handling of job notifications.
This commit is contained in:
parent
bec253cde8
commit
470a0edd80
@ -299,10 +299,13 @@ export class DocumentPrinterClient {
|
||||
|
||||
async updateJobState(jobId, state) {
|
||||
logger.info(`Updating job state for ${jobId}`);
|
||||
const notify =
|
||||
state?.type !== "deploying" && state?.type !== "queued";
|
||||
await this.socketClient.editObject({
|
||||
_id: jobId,
|
||||
objectType: "documentJob",
|
||||
updateData: { state: state },
|
||||
notify,
|
||||
});
|
||||
logger.info(`Updated job state for ${jobId}:`, state);
|
||||
}
|
||||
|
||||
@ -430,7 +430,14 @@ export class SocketClient {
|
||||
});
|
||||
}
|
||||
|
||||
async editObject({ objectType, _id, populate, updateData, auditLog = true }) {
|
||||
async editObject({
|
||||
objectType,
|
||||
_id,
|
||||
populate,
|
||||
updateData,
|
||||
auditLog = true,
|
||||
notify = true,
|
||||
}) {
|
||||
logger.trace("Editing object...", {
|
||||
objectType,
|
||||
_id,
|
||||
@ -445,6 +452,7 @@ export class SocketClient {
|
||||
populate,
|
||||
updateData,
|
||||
auditLog,
|
||||
notify,
|
||||
},
|
||||
(result) => {
|
||||
if (result && result.error) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user