(res: any)
| 531 | |
| 532 | return new Promise((resolve, reject) => { |
| 533 | const handleOutput = (res: any) => { |
| 534 | const {status} = res; |
| 535 | |
| 536 | if (job) { |
| 537 | const callbackJob = getState().callbackJobs[job]; |
| 538 | if (callbackJob?.outdated) { |
| 539 | dispatch(removeCallbackJob({jobId: job})); |
| 540 | return resolve({}); |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | function recordProfile(result: any) { |
| 545 | if (config.ui) { |
| 546 | // Callback profiling - only relevant if we're showing the debug ui |
| 547 | const resources = { |
| 548 | __dash_server: 0, |
| 549 | __dash_client: Date.now() - requestTime, |
| 550 | __dash_upload: body.length, |
| 551 | __dash_download: Number( |
| 552 | res.headers.get('Content-Length') |
| 553 | ) |
| 554 | } as any; |
| 555 | |
| 556 | const timingHeaders = |
| 557 | res.headers.get('Server-Timing') || ''; |
| 558 | |
| 559 | timingHeaders.split(',').forEach((header: any) => { |
| 560 | const name = header.split(';')[0]; |
| 561 | const dur = header.match(/;dur=[0-9.]+/); |
| 562 | |
| 563 | if (dur) { |
| 564 | resources[name] = Number(dur[0].slice(5)); |
| 565 | } |
| 566 | }); |
| 567 | |
| 568 | dispatch( |
| 569 | updateResourceUsage({ |
| 570 | id: payload.output, |
| 571 | usage: resources, |
| 572 | status, |
| 573 | result, |
| 574 | inputs: payload.inputs, |
| 575 | state: payload.state |
| 576 | }) |
| 577 | ); |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | const finishLine = (data: CallbackResponseData) => { |
| 582 | const {multi, response} = data; |
| 583 | if (hooks.request_post) { |
| 584 | hooks.request_post(payload, response); |
| 585 | } |
| 586 | |
| 587 | let result; |
| 588 | if (multi) { |
| 589 | result = response as CallbackResponse; |
| 590 | } else { |
nothing calls this directly
no test coverage detected
searching dependent graphs…