apify 4.0.0-beta.147 → 4.0.0-beta.148
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actor.js +21 -6
- package/package.json +2 -2
package/dist/actor.js
CHANGED
|
@@ -451,10 +451,27 @@ export class Actor {
|
|
|
451
451
|
// Like `ActorClient.call()`, but the run is recorded before it is waited for.
|
|
452
452
|
const { waitSecs, log, timeoutSecs = 'noTimeout', signal, ...startOptions } = rest;
|
|
453
453
|
const run = await this.#childRunTracker.startChildRun(client, abortWithParent, async () => client.actor(actorId).start(input, { ...startOptions, runTimeoutSecs, timeoutSecs, signal }));
|
|
454
|
-
|
|
454
|
+
return this.#waitForChildRun(client, run, { log, waitSecs, timeoutSecs, signal });
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Waits for a child run to finish while its log is redirected, like `call()` of `apify-client`, and records the
|
|
458
|
+
* status it finished in.
|
|
459
|
+
*/
|
|
460
|
+
async #waitForChildRun(client, run, { log: toLog, ...waitOptions }) {
|
|
461
|
+
const runClient = client.run(run.id);
|
|
462
|
+
let streamedLog;
|
|
463
|
+
try {
|
|
464
|
+
streamedLog = await runClient.getStreamedLog({ toLog, signal: waitOptions.signal });
|
|
465
|
+
}
|
|
466
|
+
catch (error) {
|
|
467
|
+
// An aborted call rejects with the reason of its signal, which the wait below takes care of.
|
|
468
|
+
if (!waitOptions.signal?.aborted) {
|
|
469
|
+
log.warning(`Waiting for run ${run.id} without log redirection, which could not be set up: ${error.message}`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
455
472
|
streamedLog?.start();
|
|
456
473
|
try {
|
|
457
|
-
const finishedRun = await
|
|
474
|
+
const finishedRun = await runClient.waitForFinish(waitOptions);
|
|
458
475
|
await this.#childRunTracker.update(finishedRun);
|
|
459
476
|
return finishedRun;
|
|
460
477
|
}
|
|
@@ -570,11 +587,9 @@ export class Actor {
|
|
|
570
587
|
const { token, timeout: _timeout, abortWithParent = false, ...rest } = options;
|
|
571
588
|
const client = token ? this.newClient({ token }) : this.apifyClient;
|
|
572
589
|
// Like `TaskClient.call()`, but the run is recorded before it is waited for.
|
|
573
|
-
const { waitSecs, timeoutSecs = 'noTimeout', signal, ...startOptions } = rest;
|
|
590
|
+
const { waitSecs, log, timeoutSecs = 'noTimeout', signal, ...startOptions } = rest;
|
|
574
591
|
const run = await this.#childRunTracker.startChildRun(client, abortWithParent, async () => client.task(taskId).start(input, { ...startOptions, runTimeoutSecs, timeoutSecs, signal }));
|
|
575
|
-
|
|
576
|
-
await this.#childRunTracker.update(finishedRun);
|
|
577
|
-
return finishedRun;
|
|
592
|
+
return this.#waitForChildRun(client, run, { log, waitSecs, timeoutSecs, signal });
|
|
578
593
|
}
|
|
579
594
|
/**
|
|
580
595
|
* Returns a client for each child run started by `Actor.start()`, `Actor.call()`, `Actor.startTask()` or
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apify",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.148",
|
|
4
4
|
"description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.13.0"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@crawlee/fs-storage": "4.0.0-beta.348",
|
|
66
66
|
"@crawlee/types": "4.0.0-beta.348",
|
|
67
67
|
"@crawlee/utils": "4.0.0-beta.348",
|
|
68
|
-
"apify-client": "
|
|
68
|
+
"apify-client": "3.0.0-beta.127",
|
|
69
69
|
"minimatch": "^11.0.10",
|
|
70
70
|
"tslib": "^2.9.1",
|
|
71
71
|
"ws": "^8.23.1",
|