IO-3576 Fortellis Refetch Make Model
Signed-off-by: Allan Carr <allan@imexsystems.ca>
This commit is contained in:
@@ -235,18 +235,6 @@ async function MakeFortellisCall({
|
||||
// jobid: socket?.recordid
|
||||
// });
|
||||
|
||||
if (result.data.checkStatusAfterSeconds) {
|
||||
return DelayedCallback({
|
||||
delayMeta: result.data,
|
||||
access_token,
|
||||
SubscriptionID: SubscriptionMeta.subscriptionId,
|
||||
ReqId,
|
||||
departmentIds: DepartmentId
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
logger.log(
|
||||
"fortellis-log-event-json",
|
||||
"DEBUG",
|
||||
@@ -261,6 +249,18 @@ async function MakeFortellisCall({
|
||||
},
|
||||
);
|
||||
|
||||
if (result.data.checkStatusAfterSeconds) {
|
||||
return DelayedCallback({
|
||||
delayMeta: result.data,
|
||||
access_token,
|
||||
SubscriptionID: SubscriptionMeta.subscriptionId,
|
||||
ReqId,
|
||||
departmentIds: DepartmentId,
|
||||
jobid,
|
||||
socket
|
||||
});
|
||||
}
|
||||
|
||||
return result.data;
|
||||
} catch (error) {
|
||||
const errorDetails = {
|
||||
@@ -310,7 +310,7 @@ async function MakeFortellisCall({
|
||||
//Some Fortellis calls return a batch result that isn't ready immediately.
|
||||
//This function will check the status of the call and wait until it is ready.
|
||||
//It will try 5 times before giving up.
|
||||
async function DelayedCallback({ delayMeta, access_token, SubscriptionID, ReqId, departmentIds }) {
|
||||
async function DelayedCallback({ delayMeta, access_token, SubscriptionID, ReqId, departmentIds, jobid, socket }) {
|
||||
for (let index = 0; index < 5; index++) {
|
||||
await sleep(delayMeta.checkStatusAfterSeconds * 1000);
|
||||
//Check to see if the call is ready.
|
||||
@@ -334,6 +334,19 @@ async function DelayedCallback({ delayMeta, access_token, SubscriptionID, ReqId,
|
||||
//"Department-Id": departmentIds[0].id
|
||||
}
|
||||
});
|
||||
logger.log(
|
||||
"fortellis-log-event-json-DelayedCallback",
|
||||
"DEBUG",
|
||||
socket?.user?.email,
|
||||
jobid,
|
||||
{
|
||||
requestcurl: batchResult.config.curlCommand,
|
||||
reqid: batchResult.config.headers["Request-Id"] || null,
|
||||
subscriptionId: batchResult.config.headers["Subscription-Id"] || null,
|
||||
resultdata: batchResult.data,
|
||||
resultStatus: batchResult.status
|
||||
},
|
||||
);
|
||||
// await writeFortellisLogToFile({
|
||||
// timestamp: new Date().toISOString(),
|
||||
// reqId: ReqId,
|
||||
|
||||
Reference in New Issue
Block a user