Skip to content

Commit

Permalink
Implemented: support for the scheduling of job if not exist for curre…
Browse files Browse the repository at this point in the history
…nt routingGroupId (#293)
  • Loading branch information
amansinghbais committed Aug 6, 2024
1 parent d5757f1 commit 3381fc8
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/services/UserService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,39 @@ const runNow = async (): Promise<any> => {
throw resp.data;
}

let job;
resp = await client({
url: `groups/${routingGroupId}/schedule`,
method: "GET",
baseURL,
headers: {
"api_key": omsRedirectionInfo.token,
"Content-Type": "application/json"
}
})

if(!hasError(resp)) {
job = resp.data.schedule
console.log(job);
} else {
throw resp.data;
}

if(!job.jobName) {
resp = await client({
url: `groups/${routingGroupId}/schedule`,
method: "POST",
baseURL,
headers: {
"api_key": omsRedirectionInfo.token,
"Content-Type": "application/json"
}
});
if(hasError(resp)) {
throw resp.data;
}
}

resp = await client({
url: `groups/${routingGroupId}/runNow`,
method: "POST",
Expand Down

0 comments on commit 3381fc8

Please sign in to comment.