apify 2.3.1-beta.4 → 3.0.0-alpha.0
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/README.md +6 -5
- package/package.json +69 -128
- package/build/actor.d.ts +0 -113
- package/build/actor.d.ts.map +0 -1
- package/build/actor.js +0 -582
- package/build/actor.js.map +0 -1
- package/build/apify.d.ts +0 -752
- package/build/apify.d.ts.map +0 -1
- package/build/apify.js +0 -877
- package/build/apify.js.map +0 -1
- package/build/autoscaling/autoscaled_pool.d.ts +0 -384
- package/build/autoscaling/autoscaled_pool.d.ts.map +0 -1
- package/build/autoscaling/autoscaled_pool.js +0 -557
- package/build/autoscaling/autoscaled_pool.js.map +0 -1
- package/build/autoscaling/snapshotter.d.ts +0 -278
- package/build/autoscaling/snapshotter.d.ts.map +0 -1
- package/build/autoscaling/snapshotter.js +0 -447
- package/build/autoscaling/snapshotter.js.map +0 -1
- package/build/autoscaling/system_status.d.ts +0 -224
- package/build/autoscaling/system_status.d.ts.map +0 -1
- package/build/autoscaling/system_status.js +0 -228
- package/build/autoscaling/system_status.js.map +0 -1
- package/build/browser_launchers/browser_launcher.d.ts +0 -154
- package/build/browser_launchers/browser_launcher.d.ts.map +0 -1
- package/build/browser_launchers/browser_launcher.js +0 -160
- package/build/browser_launchers/browser_launcher.js.map +0 -1
- package/build/browser_launchers/browser_plugin.d.ts +0 -23
- package/build/browser_launchers/browser_plugin.d.ts.map +0 -1
- package/build/browser_launchers/browser_plugin.js +0 -25
- package/build/browser_launchers/browser_plugin.js.map +0 -1
- package/build/browser_launchers/playwright_launcher.d.ts +0 -131
- package/build/browser_launchers/playwright_launcher.d.ts.map +0 -1
- package/build/browser_launchers/playwright_launcher.js +0 -150
- package/build/browser_launchers/playwright_launcher.js.map +0 -1
- package/build/browser_launchers/puppeteer_launcher.d.ts +0 -153
- package/build/browser_launchers/puppeteer_launcher.d.ts.map +0 -1
- package/build/browser_launchers/puppeteer_launcher.js +0 -197
- package/build/browser_launchers/puppeteer_launcher.js.map +0 -1
- package/build/cache_container.d.ts +0 -31
- package/build/cache_container.d.ts.map +0 -1
- package/build/cache_container.js +0 -48
- package/build/cache_container.js.map +0 -1
- package/build/configuration.d.ts +0 -226
- package/build/configuration.d.ts.map +0 -1
- package/build/configuration.js +0 -325
- package/build/configuration.js.map +0 -1
- package/build/constants.d.ts +0 -37
- package/build/constants.d.ts.map +0 -1
- package/build/constants.js +0 -41
- package/build/constants.js.map +0 -1
- package/build/crawlers/basic_crawler.d.ts +0 -443
- package/build/crawlers/basic_crawler.d.ts.map +0 -1
- package/build/crawlers/basic_crawler.js +0 -664
- package/build/crawlers/basic_crawler.js.map +0 -1
- package/build/crawlers/browser_crawler.d.ts +0 -512
- package/build/crawlers/browser_crawler.d.ts.map +0 -1
- package/build/crawlers/browser_crawler.js +0 -540
- package/build/crawlers/browser_crawler.js.map +0 -1
- package/build/crawlers/cheerio_crawler.d.ts +0 -931
- package/build/crawlers/cheerio_crawler.d.ts.map +0 -1
- package/build/crawlers/cheerio_crawler.js +0 -913
- package/build/crawlers/cheerio_crawler.js.map +0 -1
- package/build/crawlers/crawler_extension.d.ts +0 -10
- package/build/crawlers/crawler_extension.d.ts.map +0 -1
- package/build/crawlers/crawler_extension.js +0 -19
- package/build/crawlers/crawler_extension.js.map +0 -1
- package/build/crawlers/crawler_utils.d.ts +0 -34
- package/build/crawlers/crawler_utils.d.ts.map +0 -1
- package/build/crawlers/crawler_utils.js +0 -87
- package/build/crawlers/crawler_utils.js.map +0 -1
- package/build/crawlers/playwright_crawler.d.ts +0 -448
- package/build/crawlers/playwright_crawler.d.ts.map +0 -1
- package/build/crawlers/playwright_crawler.js +0 -299
- package/build/crawlers/playwright_crawler.js.map +0 -1
- package/build/crawlers/puppeteer_crawler.d.ts +0 -425
- package/build/crawlers/puppeteer_crawler.d.ts.map +0 -1
- package/build/crawlers/puppeteer_crawler.js +0 -299
- package/build/crawlers/puppeteer_crawler.js.map +0 -1
- package/build/crawlers/statistics.d.ts +0 -185
- package/build/crawlers/statistics.d.ts.map +0 -1
- package/build/crawlers/statistics.js +0 -331
- package/build/crawlers/statistics.js.map +0 -1
- package/build/enqueue_links/click_elements.d.ts +0 -179
- package/build/enqueue_links/click_elements.d.ts.map +0 -1
- package/build/enqueue_links/click_elements.js +0 -434
- package/build/enqueue_links/click_elements.js.map +0 -1
- package/build/enqueue_links/enqueue_links.d.ts +0 -117
- package/build/enqueue_links/enqueue_links.d.ts.map +0 -1
- package/build/enqueue_links/enqueue_links.js +0 -163
- package/build/enqueue_links/enqueue_links.js.map +0 -1
- package/build/enqueue_links/shared.d.ts +0 -42
- package/build/enqueue_links/shared.d.ts.map +0 -1
- package/build/enqueue_links/shared.js +0 -121
- package/build/enqueue_links/shared.js.map +0 -1
- package/build/errors.d.ts +0 -29
- package/build/errors.d.ts.map +0 -1
- package/build/errors.js +0 -38
- package/build/errors.js.map +0 -1
- package/build/events.d.ts +0 -11
- package/build/events.d.ts.map +0 -1
- package/build/events.js +0 -147
- package/build/events.js.map +0 -1
- package/build/index.d.ts +0 -4
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -7
- package/build/index.js.map +0 -1
- package/build/main.d.ts +0 -179
- package/build/main.d.ts.map +0 -1
- package/build/main.js +0 -81
- package/build/main.js.map +0 -1
- package/build/playwright_utils.d.ts +0 -9
- package/build/playwright_utils.d.ts.map +0 -1
- package/build/playwright_utils.js +0 -90
- package/build/playwright_utils.js.map +0 -1
- package/build/proxy_configuration.d.ts +0 -411
- package/build/proxy_configuration.d.ts.map +0 -1
- package/build/proxy_configuration.js +0 -517
- package/build/proxy_configuration.js.map +0 -1
- package/build/pseudo_url.d.ts +0 -86
- package/build/pseudo_url.d.ts.map +0 -1
- package/build/pseudo_url.js +0 -153
- package/build/pseudo_url.js.map +0 -1
- package/build/puppeteer_request_interception.d.ts +0 -8
- package/build/puppeteer_request_interception.d.ts.map +0 -1
- package/build/puppeteer_request_interception.js +0 -235
- package/build/puppeteer_request_interception.js.map +0 -1
- package/build/puppeteer_utils.d.ts +0 -250
- package/build/puppeteer_utils.d.ts.map +0 -1
- package/build/puppeteer_utils.js +0 -551
- package/build/puppeteer_utils.js.map +0 -1
- package/build/request.d.ts +0 -180
- package/build/request.d.ts.map +0 -1
- package/build/request.js +0 -261
- package/build/request.js.map +0 -1
- package/build/request_list.d.ts +0 -581
- package/build/request_list.d.ts.map +0 -1
- package/build/request_list.js +0 -826
- package/build/request_list.js.map +0 -1
- package/build/serialization.d.ts +0 -5
- package/build/serialization.d.ts.map +0 -1
- package/build/serialization.js +0 -139
- package/build/serialization.js.map +0 -1
- package/build/session_pool/errors.d.ts +0 -11
- package/build/session_pool/errors.d.ts.map +0 -1
- package/build/session_pool/errors.js +0 -18
- package/build/session_pool/errors.js.map +0 -1
- package/build/session_pool/events.d.ts +0 -5
- package/build/session_pool/events.d.ts.map +0 -1
- package/build/session_pool/events.js +0 -6
- package/build/session_pool/events.js.map +0 -1
- package/build/session_pool/session.d.ts +0 -286
- package/build/session_pool/session.d.ts.map +0 -1
- package/build/session_pool/session.js +0 -355
- package/build/session_pool/session.js.map +0 -1
- package/build/session_pool/session_pool.d.ts +0 -280
- package/build/session_pool/session_pool.d.ts.map +0 -1
- package/build/session_pool/session_pool.js +0 -393
- package/build/session_pool/session_pool.js.map +0 -1
- package/build/session_pool/session_utils.d.ts +0 -4
- package/build/session_pool/session_utils.d.ts.map +0 -1
- package/build/session_pool/session_utils.js +0 -24
- package/build/session_pool/session_utils.js.map +0 -1
- package/build/stealth/hiding_tricks.d.ts +0 -22
- package/build/stealth/hiding_tricks.d.ts.map +0 -1
- package/build/stealth/hiding_tricks.js +0 -308
- package/build/stealth/hiding_tricks.js.map +0 -1
- package/build/stealth/stealth.d.ts +0 -56
- package/build/stealth/stealth.d.ts.map +0 -1
- package/build/stealth/stealth.js +0 -125
- package/build/stealth/stealth.js.map +0 -1
- package/build/storages/dataset.d.ts +0 -288
- package/build/storages/dataset.d.ts.map +0 -1
- package/build/storages/dataset.js +0 -480
- package/build/storages/dataset.js.map +0 -1
- package/build/storages/key_value_store.d.ts +0 -243
- package/build/storages/key_value_store.d.ts.map +0 -1
- package/build/storages/key_value_store.js +0 -462
- package/build/storages/key_value_store.js.map +0 -1
- package/build/storages/request_queue.d.ts +0 -318
- package/build/storages/request_queue.d.ts.map +0 -1
- package/build/storages/request_queue.js +0 -636
- package/build/storages/request_queue.js.map +0 -1
- package/build/storages/storage_manager.d.ts +0 -87
- package/build/storages/storage_manager.d.ts.map +0 -1
- package/build/storages/storage_manager.js +0 -150
- package/build/storages/storage_manager.js.map +0 -1
- package/build/tsconfig.tsbuildinfo +0 -1
- package/build/typedefs.d.ts +0 -146
- package/build/typedefs.d.ts.map +0 -1
- package/build/typedefs.js +0 -88
- package/build/typedefs.js.map +0 -1
- package/build/utils.d.ts +0 -175
- package/build/utils.d.ts.map +0 -1
- package/build/utils.js +0 -731
- package/build/utils.js.map +0 -1
- package/build/utils_log.d.ts +0 -41
- package/build/utils_log.d.ts.map +0 -1
- package/build/utils_log.js +0 -192
- package/build/utils_log.js.map +0 -1
- package/build/utils_request.d.ts +0 -77
- package/build/utils_request.d.ts.map +0 -1
- package/build/utils_request.js +0 -385
- package/build/utils_request.js.map +0 -1
- package/build/utils_social.d.ts +0 -210
- package/build/utils_social.d.ts.map +0 -1
- package/build/utils_social.js +0 -787
- package/build/utils_social.js.map +0 -1
- package/build/validators.d.ts +0 -23
- package/build/validators.d.ts.map +0 -1
- package/build/validators.js +0 -29
- package/build/validators.js.map +0 -1
|
@@ -1,636 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.openRequestQueue = exports.RequestQueue = exports.getRequestId = exports.STORAGE_CONSISTENCY_DELAY_MILLIS = exports.MAX_QUERIES_FOR_CONSISTENCY = exports.API_PROCESSED_REQUESTS_DELAY_MILLIS = exports.QUERY_HEAD_BUFFER = exports.QUERY_HEAD_MIN_LENGTH = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const crypto_1 = (0, tslib_1.__importDefault)(require("crypto"));
|
|
6
|
-
const datastructures_1 = require("@apify/datastructures");
|
|
7
|
-
const consts_1 = require("@apify/consts");
|
|
8
|
-
const utilities_1 = require("@apify/utilities");
|
|
9
|
-
const ow_1 = (0, tslib_1.__importDefault)(require("ow"));
|
|
10
|
-
const storage_manager_1 = require("./storage_manager");
|
|
11
|
-
const utils_1 = require("../utils");
|
|
12
|
-
const utils_log_1 = (0, tslib_1.__importDefault)(require("../utils_log"));
|
|
13
|
-
/* eslint-disable no-unused-vars,import/named,import/no-duplicates,import/order */
|
|
14
|
-
const request_1 = (0, tslib_1.__importDefault)(require("../request")); // eslint-disable-line import/named,no-unused-vars
|
|
15
|
-
/* eslint-enable no-unused-vars,import/named,import/no-duplicates,import/order */
|
|
16
|
-
const MAX_CACHED_REQUESTS = 1000 * 1000;
|
|
17
|
-
// When requesting queue head we always fetch requestsInProgressCount * QUERY_HEAD_BUFFER number of requests.
|
|
18
|
-
exports.QUERY_HEAD_MIN_LENGTH = 100;
|
|
19
|
-
exports.QUERY_HEAD_BUFFER = 3;
|
|
20
|
-
// If queue was modified (request added/updated/deleted) before more than API_PROCESSED_REQUESTS_DELAY_MILLIS
|
|
21
|
-
// then we assume the get head operation to be consistent.
|
|
22
|
-
exports.API_PROCESSED_REQUESTS_DELAY_MILLIS = 10 * 1000;
|
|
23
|
-
// How many times we try to get queue head with queueModifiedAt older than API_PROCESSED_REQUESTS_DELAY_MILLIS.
|
|
24
|
-
exports.MAX_QUERIES_FOR_CONSISTENCY = 6;
|
|
25
|
-
// This number must be large enough so that processing of all these requests cannot be done in
|
|
26
|
-
// a time lower than expected maximum latency of DynamoDB, but low enough not to waste too much memory.
|
|
27
|
-
const RECENTLY_HANDLED_CACHE_SIZE = 1000;
|
|
28
|
-
// Indicates how long it usually takes for the underlying storage to propagate all writes
|
|
29
|
-
// to be available to subsequent reads.
|
|
30
|
-
exports.STORAGE_CONSISTENCY_DELAY_MILLIS = 3000;
|
|
31
|
-
/**
|
|
32
|
-
* Helper function that creates ID from uniqueKey for local emulation of request queue.
|
|
33
|
-
* It's also used for local cache of remote request queue.
|
|
34
|
-
*
|
|
35
|
-
* This function may not exactly match how requestId is created server side.
|
|
36
|
-
* So we never pass requestId created by this to server and use it only for local cache.
|
|
37
|
-
*
|
|
38
|
-
* @ignore
|
|
39
|
-
*/
|
|
40
|
-
const getRequestId = (uniqueKey) => {
|
|
41
|
-
const str = crypto_1.default
|
|
42
|
-
.createHash('sha256')
|
|
43
|
-
.update(uniqueKey)
|
|
44
|
-
.digest('base64')
|
|
45
|
-
.replace(/(\+|\/|=)/g, '');
|
|
46
|
-
return str.substr(0, 15);
|
|
47
|
-
};
|
|
48
|
-
exports.getRequestId = getRequestId;
|
|
49
|
-
/**
|
|
50
|
-
* A helper class that is used to report results from various
|
|
51
|
-
* {@link RequestQueue} functions as well as
|
|
52
|
-
* {@link utils#enqueueLinks}.
|
|
53
|
-
*
|
|
54
|
-
* @typedef QueueOperationInfo
|
|
55
|
-
* @property {boolean} wasAlreadyPresent Indicates if request was already present in the queue.
|
|
56
|
-
* @property {boolean} wasAlreadyHandled Indicates if request was already marked as handled.
|
|
57
|
-
* @property {string} requestId The ID of the added request
|
|
58
|
-
* @property {Request} request The original {@link Request} object passed to the `RequestQueue` function.
|
|
59
|
-
*/
|
|
60
|
-
/**
|
|
61
|
-
* Represents a queue of URLs to crawl, which is used for deep crawling of websites
|
|
62
|
-
* where you start with several URLs and then recursively
|
|
63
|
-
* follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders.
|
|
64
|
-
*
|
|
65
|
-
* Each URL is represented using an instance of the {@link Request} class.
|
|
66
|
-
* The queue can only contain unique URLs. More precisely, it can only contain {@link Request} instances
|
|
67
|
-
* with distinct `uniqueKey` properties. By default, `uniqueKey` is generated from the URL, but it can also be overridden.
|
|
68
|
-
* To add a single URL multiple times to the queue,
|
|
69
|
-
* corresponding {@link Request} objects will need to have different `uniqueKey` properties.
|
|
70
|
-
*
|
|
71
|
-
* Do not instantiate this class directly, use the
|
|
72
|
-
* {@link Apify#openRequestQueue} function instead.
|
|
73
|
-
*
|
|
74
|
-
* `RequestQueue` is used by {@link BasicCrawler}, {@link CheerioCrawler}, {@link PuppeteerCrawler}
|
|
75
|
-
* and {@link PlaywrightCrawler} as a source of URLs to crawl.
|
|
76
|
-
* Unlike {@link RequestList}, `RequestQueue` supports dynamic adding and removing of requests.
|
|
77
|
-
* On the other hand, the queue is not optimized for operations that add or remove a large number of URLs in a batch.
|
|
78
|
-
*
|
|
79
|
-
* `RequestQueue` stores its data either on local disk or in the Apify Cloud,
|
|
80
|
-
* depending on whether the `APIFY_LOCAL_STORAGE_DIR` or `APIFY_TOKEN` environment variable is set.
|
|
81
|
-
*
|
|
82
|
-
* If the `APIFY_LOCAL_STORAGE_DIR` environment variable is set, the queue data is stored in
|
|
83
|
-
* that directory in an SQLite database file.
|
|
84
|
-
*
|
|
85
|
-
* If the `APIFY_TOKEN` environment variable is set but `APIFY_LOCAL_STORAGE_DIR` is not, the data is stored in the
|
|
86
|
-
* [Apify Request Queue](https://docs.apify.com/storage/request-queue)
|
|
87
|
-
* cloud storage. Note that you can force usage of the cloud storage also by passing the `forceCloud`
|
|
88
|
-
* option to {@link Apify#openRequestQueue} function,
|
|
89
|
-
* even if the `APIFY_LOCAL_STORAGE_DIR` variable is set.
|
|
90
|
-
*
|
|
91
|
-
* **Example usage:**
|
|
92
|
-
*
|
|
93
|
-
* ```javascript
|
|
94
|
-
* // Open the default request queue associated with the actor run
|
|
95
|
-
* const queue = await Apify.openRequestQueue();
|
|
96
|
-
*
|
|
97
|
-
* // Open a named request queue
|
|
98
|
-
* const queueWithName = await Apify.openRequestQueue('some-name');
|
|
99
|
-
*
|
|
100
|
-
* // Enqueue few requests
|
|
101
|
-
* await queue.addRequest({ url: 'http://example.com/aaa' });
|
|
102
|
-
* await queue.addRequest({ url: 'http://example.com/bbb' });
|
|
103
|
-
* await queue.addRequest({ url: 'http://example.com/foo/bar' }, { forefront: true });
|
|
104
|
-
* ```
|
|
105
|
-
* @hideconstructor
|
|
106
|
-
*/
|
|
107
|
-
class RequestQueue {
|
|
108
|
-
/**
|
|
109
|
-
* @param {object} options
|
|
110
|
-
* @param {string} options.id
|
|
111
|
-
* @param {string} [options.name]
|
|
112
|
-
* @param {boolean} options.isLocal
|
|
113
|
-
* @param {ApifyClient|ApifyStorageLocal} options.client
|
|
114
|
-
*/
|
|
115
|
-
constructor(options) {
|
|
116
|
-
this.id = options.id;
|
|
117
|
-
this.name = options.name;
|
|
118
|
-
this.isLocal = options.isLocal;
|
|
119
|
-
this.timeoutSecs = 30;
|
|
120
|
-
this.clientKey = (0, utilities_1.cryptoRandomObjectId)();
|
|
121
|
-
this.client = options.client.requestQueue(this.id, {
|
|
122
|
-
clientKey: this.clientKey,
|
|
123
|
-
timeoutSecs: this.timeoutSecs,
|
|
124
|
-
});
|
|
125
|
-
this.log = utils_log_1.default.child({ prefix: 'RequestQueue' });
|
|
126
|
-
// Contains a cached list of request IDs from the head of the queue,
|
|
127
|
-
// as obtained in the last query. Both key and value is the request ID.
|
|
128
|
-
// Need to apply a type here to the generated TS types don't try to use types-apify
|
|
129
|
-
/**
|
|
130
|
-
* @type {*}
|
|
131
|
-
* @ignore
|
|
132
|
-
*/
|
|
133
|
-
this.queueHeadDict = new datastructures_1.ListDictionary();
|
|
134
|
-
this.queryQueueHeadPromise = null;
|
|
135
|
-
// A set of all request IDs that are currently being handled,
|
|
136
|
-
// i.e. which were returned by fetchNextRequest() but not markRequestHandled()
|
|
137
|
-
this.inProgress = new Set();
|
|
138
|
-
// To track whether the queue gets stuck, and we need to reset it
|
|
139
|
-
// `lastActivity` tracks the time when we either added, processed or reclaimed a request,
|
|
140
|
-
// or when we add new request to in-progress cache
|
|
141
|
-
this.lastActivity = new Date();
|
|
142
|
-
this.internalTimeoutMillis = 5 * 60e3; // defaults to 5 minutes, will be overridden by BasicCrawler
|
|
143
|
-
// Contains a list of recently handled requests. It is used to avoid inconsistencies
|
|
144
|
-
// caused by delays in the underlying DynamoDB storage.
|
|
145
|
-
// Keys are request IDs, values are true.
|
|
146
|
-
this.recentlyHandled = new datastructures_1.LruCache({ maxLength: RECENTLY_HANDLED_CACHE_SIZE });
|
|
147
|
-
// We can trust these numbers only in a case that queue is used by a single client.
|
|
148
|
-
// This information is returned by getHead() under the hadMultipleClients property.
|
|
149
|
-
this.assumedTotalCount = 0;
|
|
150
|
-
this.assumedHandledCount = 0;
|
|
151
|
-
// Caching requests to avoid redundant addRequest() calls.
|
|
152
|
-
// Key is computed using getRequestId() and value is { id, isHandled }.
|
|
153
|
-
// TODO: We could extend the caching to improve performance
|
|
154
|
-
// of other operations such as fetchNextRequest().
|
|
155
|
-
this.requestsCache = new datastructures_1.LruCache({ maxLength: MAX_CACHED_REQUESTS });
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* @ignore
|
|
159
|
-
*/
|
|
160
|
-
inProgressCount() {
|
|
161
|
-
return this.inProgress.size;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Adds a request to the queue.
|
|
165
|
-
*
|
|
166
|
-
* If a request with the same `uniqueKey` property is already present in the queue,
|
|
167
|
-
* it will not be updated. You can find out whether this happened from the resulting
|
|
168
|
-
* {@link QueueOperationInfo} object.
|
|
169
|
-
*
|
|
170
|
-
* To add multiple requests to the queue by extracting links from a webpage,
|
|
171
|
-
* see the {@link utils#enqueueLinks} helper function.
|
|
172
|
-
*
|
|
173
|
-
* @param {(Request|RequestOptions)} requestLike {@link Request} object or vanilla object with request data.
|
|
174
|
-
* Note that the function sets the `uniqueKey` and `id` fields to the passed Request.
|
|
175
|
-
* @param {Object} [options]
|
|
176
|
-
* @param {boolean} [options.forefront=false] If `true`, the request will be added to the foremost position in the queue.
|
|
177
|
-
* @return {Promise<QueueOperationInfo>}
|
|
178
|
-
*/
|
|
179
|
-
async addRequest(requestLike, options = {}) {
|
|
180
|
-
(0, ow_1.default)(requestLike, ow_1.default.object.partialShape({
|
|
181
|
-
url: ow_1.default.string.url,
|
|
182
|
-
id: ow_1.default.undefined,
|
|
183
|
-
}));
|
|
184
|
-
(0, ow_1.default)(options, ow_1.default.object.exactShape({
|
|
185
|
-
forefront: ow_1.default.optional.boolean,
|
|
186
|
-
}));
|
|
187
|
-
this.lastActivity = new Date();
|
|
188
|
-
const { forefront = false } = options;
|
|
189
|
-
const request = requestLike instanceof request_1.default
|
|
190
|
-
? requestLike
|
|
191
|
-
: new request_1.default(requestLike);
|
|
192
|
-
const cacheKey = (0, exports.getRequestId)(request.uniqueKey);
|
|
193
|
-
const cachedInfo = this.requestsCache.get(cacheKey);
|
|
194
|
-
if (cachedInfo) {
|
|
195
|
-
request.id = cachedInfo.id;
|
|
196
|
-
return {
|
|
197
|
-
wasAlreadyPresent: true,
|
|
198
|
-
// We may assume that if request is in local cache then also the information if the
|
|
199
|
-
// request was already handled is there because just one client should be using one queue.
|
|
200
|
-
wasAlreadyHandled: cachedInfo.isHandled,
|
|
201
|
-
requestId: cachedInfo.id,
|
|
202
|
-
request,
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
const queueOperationInfo = await this.client.addRequest(request, { forefront });
|
|
206
|
-
const { requestId, wasAlreadyPresent } = queueOperationInfo;
|
|
207
|
-
this._cacheRequest(cacheKey, queueOperationInfo);
|
|
208
|
-
if (!wasAlreadyPresent && !this.inProgress.has(requestId) && !this.recentlyHandled.get(requestId)) {
|
|
209
|
-
this.assumedTotalCount++;
|
|
210
|
-
// Performance optimization: add request straight to head if possible
|
|
211
|
-
this._maybeAddRequestToQueueHead(requestId, forefront);
|
|
212
|
-
}
|
|
213
|
-
queueOperationInfo.request = { ...request, id: requestId };
|
|
214
|
-
return queueOperationInfo;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Gets the request from the queue specified by ID.
|
|
218
|
-
*
|
|
219
|
-
* @param {string} id ID of the request.
|
|
220
|
-
* @return {Promise<(Request|null)>} Returns the request object, or `null` if it was not found.
|
|
221
|
-
*/
|
|
222
|
-
async getRequest(id) {
|
|
223
|
-
(0, ow_1.default)(id, ow_1.default.string);
|
|
224
|
-
// TODO: Could we also use requestsCache here? It would be consistent with addRequest()
|
|
225
|
-
// Downside is that it wouldn't reflect changes from outside...
|
|
226
|
-
const requestOptions = await this.client.getRequest(id);
|
|
227
|
-
if (!requestOptions)
|
|
228
|
-
return null;
|
|
229
|
-
// TODO: compatibility fix for old/broken request queues with null Request props
|
|
230
|
-
const optionsWithoutNulls = Object.entries(requestOptions).reduce((opts, [key, value]) => {
|
|
231
|
-
if (value !== null) {
|
|
232
|
-
opts[key] = value;
|
|
233
|
-
}
|
|
234
|
-
return opts;
|
|
235
|
-
}, {});
|
|
236
|
-
return new request_1.default(optionsWithoutNulls);
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Returns a next request in the queue to be processed, or `null` if there are no more pending requests.
|
|
240
|
-
*
|
|
241
|
-
* Once you successfully finish processing of the request, you need to call
|
|
242
|
-
* {@link RequestQueue#markRequestHandled}
|
|
243
|
-
* to mark the request as handled in the queue. If there was some error in processing the request,
|
|
244
|
-
* call {@link RequestQueue#reclaimRequest} instead,
|
|
245
|
-
* so that the queue will give the request to some other consumer in another call to the `fetchNextRequest` function.
|
|
246
|
-
*
|
|
247
|
-
* Note that the `null` return value doesn't mean the queue processing finished,
|
|
248
|
-
* it means there are currently no pending requests.
|
|
249
|
-
* To check whether all requests in queue were finished,
|
|
250
|
-
* use {@link RequestQueue#isFinished} instead.
|
|
251
|
-
*
|
|
252
|
-
* @returns {Promise<(Request|null)>}
|
|
253
|
-
* Returns the request object or `null` if there are no more pending requests.
|
|
254
|
-
*/
|
|
255
|
-
async fetchNextRequest() {
|
|
256
|
-
await this._ensureHeadIsNonEmpty();
|
|
257
|
-
const nextRequestId = this.queueHeadDict.removeFirst();
|
|
258
|
-
// We are likely done at this point.
|
|
259
|
-
if (!nextRequestId)
|
|
260
|
-
return null;
|
|
261
|
-
// This should never happen, but...
|
|
262
|
-
if (this.inProgress.has(nextRequestId) || this.recentlyHandled.get(nextRequestId)) {
|
|
263
|
-
this.log.warning('Queue head returned a request that is already in progress?!', {
|
|
264
|
-
nextRequestId,
|
|
265
|
-
inProgress: this.inProgress.has(nextRequestId),
|
|
266
|
-
recentlyHandled: !!this.recentlyHandled.get(nextRequestId),
|
|
267
|
-
});
|
|
268
|
-
return null;
|
|
269
|
-
}
|
|
270
|
-
this.inProgress.add(nextRequestId);
|
|
271
|
-
this.lastActivity = new Date();
|
|
272
|
-
let request;
|
|
273
|
-
try {
|
|
274
|
-
request = await this.getRequest(nextRequestId);
|
|
275
|
-
}
|
|
276
|
-
catch (e) {
|
|
277
|
-
// On error, remove the request from in progress, otherwise it would be there forever
|
|
278
|
-
this.inProgress.delete(nextRequestId);
|
|
279
|
-
throw e;
|
|
280
|
-
}
|
|
281
|
-
// NOTE: It can happen that the queue head index is inconsistent with the main queue table. This can occur in two situations:
|
|
282
|
-
// 1) Queue head index is ahead of the main table and the request is not present in the main table yet (i.e. getRequest() returned null).
|
|
283
|
-
// In this case, keep the request marked as in progress for a short while,
|
|
284
|
-
// so that isFinished() doesn't return true and _ensureHeadIsNonEmpty() doesn't not load the request
|
|
285
|
-
// into the queueHeadDict straight again. After the interval expires, fetchNextRequest()
|
|
286
|
-
// will try to fetch this request again, until it eventually appears in the main table.
|
|
287
|
-
if (!request) {
|
|
288
|
-
this.log.debug('Cannot find a request from the beginning of queue, will be retried later', { nextRequestId });
|
|
289
|
-
setTimeout(() => {
|
|
290
|
-
this.inProgress.delete(nextRequestId);
|
|
291
|
-
}, exports.STORAGE_CONSISTENCY_DELAY_MILLIS);
|
|
292
|
-
return null;
|
|
293
|
-
}
|
|
294
|
-
// 2) Queue head index is behind the main table and the underlying request was already handled
|
|
295
|
-
// (by some other client, since we keep the track of handled requests in recentlyHandled dictionary).
|
|
296
|
-
// We just add the request to the recentlyHandled dictionary so that next call to _ensureHeadIsNonEmpty()
|
|
297
|
-
// will not put the request again to queueHeadDict.
|
|
298
|
-
if (request.handledAt) {
|
|
299
|
-
this.log.debug('Request fetched from the beginning of queue was already handled', { nextRequestId });
|
|
300
|
-
this.recentlyHandled.add(nextRequestId, true);
|
|
301
|
-
return null;
|
|
302
|
-
}
|
|
303
|
-
return request;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Marks a request that was previously returned by the
|
|
307
|
-
* {@link RequestQueue#fetchNextRequest}
|
|
308
|
-
* function as handled after successful processing.
|
|
309
|
-
* Handled requests will never again be returned by the `fetchNextRequest` function.
|
|
310
|
-
*
|
|
311
|
-
* @param {Request} request
|
|
312
|
-
* @return {Promise<QueueOperationInfo | null>}
|
|
313
|
-
*/
|
|
314
|
-
async markRequestHandled(request) {
|
|
315
|
-
this.lastActivity = new Date();
|
|
316
|
-
(0, ow_1.default)(request, ow_1.default.object.partialShape({
|
|
317
|
-
id: ow_1.default.string,
|
|
318
|
-
uniqueKey: ow_1.default.string,
|
|
319
|
-
handledAt: ow_1.default.optional.date,
|
|
320
|
-
}));
|
|
321
|
-
if (!this.inProgress.has(request.id)) {
|
|
322
|
-
this.log.debug(`Cannot mark request ${request.id} as handled, because it is not in progress!`, { requestId: request.id });
|
|
323
|
-
return null;
|
|
324
|
-
}
|
|
325
|
-
const handledAt = request.handledAt ?? new Date();
|
|
326
|
-
const queueOperationInfo = await this.client.updateRequest({ ...request, handledAt });
|
|
327
|
-
request.handledAt = handledAt;
|
|
328
|
-
this.inProgress.delete(request.id);
|
|
329
|
-
this.recentlyHandled.add(request.id, true);
|
|
330
|
-
if (!queueOperationInfo.wasAlreadyHandled) {
|
|
331
|
-
this.assumedHandledCount++;
|
|
332
|
-
}
|
|
333
|
-
this._cacheRequest((0, exports.getRequestId)(request.uniqueKey), queueOperationInfo);
|
|
334
|
-
queueOperationInfo.request = request;
|
|
335
|
-
return queueOperationInfo;
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Reclaims a failed request back to the queue, so that it can be returned for processed later again
|
|
339
|
-
* by another call to {@link RequestQueue#fetchNextRequest}.
|
|
340
|
-
* The request record in the queue is updated using the provided `request` parameter.
|
|
341
|
-
* For example, this lets you store the number of retries or error messages for the request.
|
|
342
|
-
*
|
|
343
|
-
* @param {Request} request
|
|
344
|
-
* @param {object} [options]
|
|
345
|
-
* @param {boolean} [options.forefront=false]
|
|
346
|
-
* If `true` then the request it placed to the beginning of the queue, so that it's returned
|
|
347
|
-
* in the next call to {@link RequestQueue#fetchNextRequest}.
|
|
348
|
-
* By default, it's put to the end of the queue.
|
|
349
|
-
* @return {Promise<QueueOperationInfo | null>}
|
|
350
|
-
*/
|
|
351
|
-
async reclaimRequest(request, options = {}) {
|
|
352
|
-
this.lastActivity = new Date();
|
|
353
|
-
(0, ow_1.default)(request, ow_1.default.object.partialShape({
|
|
354
|
-
id: ow_1.default.string,
|
|
355
|
-
uniqueKey: ow_1.default.string,
|
|
356
|
-
}));
|
|
357
|
-
(0, ow_1.default)(options, ow_1.default.object.exactShape({
|
|
358
|
-
forefront: ow_1.default.optional.boolean,
|
|
359
|
-
}));
|
|
360
|
-
const { forefront = false } = options;
|
|
361
|
-
if (!this.inProgress.has(request.id)) {
|
|
362
|
-
this.log.debug(`Cannot reclaim request ${request.id}, because it is not in progress!`, { requestId: request.id });
|
|
363
|
-
return null;
|
|
364
|
-
}
|
|
365
|
-
// TODO: If request hasn't been changed since the last getRequest(),
|
|
366
|
-
// we don't need to call updateRequest() and thus improve performance.
|
|
367
|
-
const queueOperationInfo = await this.client.updateRequest(request, { forefront });
|
|
368
|
-
this._cacheRequest((0, exports.getRequestId)(request.uniqueKey), queueOperationInfo);
|
|
369
|
-
queueOperationInfo.request = request;
|
|
370
|
-
// Wait a little to increase a chance that the next call to fetchNextRequest() will return the request with updated data.
|
|
371
|
-
// This is to compensate for the limitation of DynamoDB, where writes might not be immediately visible to subsequent reads.
|
|
372
|
-
setTimeout(() => {
|
|
373
|
-
if (!this.inProgress.has(request.id)) {
|
|
374
|
-
this.log.debug('The request is no longer marked as in progress in the queue?!', { requestId: request.id });
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
this.inProgress.delete(request.id);
|
|
378
|
-
// Performance optimization: add request straight to head if possible
|
|
379
|
-
this._maybeAddRequestToQueueHead(request.id, forefront);
|
|
380
|
-
}, exports.STORAGE_CONSISTENCY_DELAY_MILLIS);
|
|
381
|
-
return queueOperationInfo;
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Resolves to `true` if the next call to {@link RequestQueue#fetchNextRequest}
|
|
385
|
-
* would return `null`, otherwise it resolves to `false`.
|
|
386
|
-
* Note that even if the queue is empty, there might be some pending requests currently being processed.
|
|
387
|
-
* If you need to ensure that there is no activity in the queue, use {@link RequestQueue#isFinished}.
|
|
388
|
-
*
|
|
389
|
-
* @returns {Promise<boolean>}
|
|
390
|
-
*/
|
|
391
|
-
async isEmpty() {
|
|
392
|
-
await this._ensureHeadIsNonEmpty();
|
|
393
|
-
return this.queueHeadDict.length() === 0;
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Resolves to `true` if all requests were already handled and there are no more left.
|
|
397
|
-
* Due to the nature of distributed storage used by the queue,
|
|
398
|
-
* the function might occasionally return a false negative,
|
|
399
|
-
* but it will never return a false positive.
|
|
400
|
-
*
|
|
401
|
-
* @returns {Promise<boolean>}
|
|
402
|
-
*/
|
|
403
|
-
async isFinished() {
|
|
404
|
-
if (this.inProgressCount() > 0 && (Date.now() - +this.lastActivity) > this.internalTimeoutMillis) {
|
|
405
|
-
const message = `The request queue seems to be stuck for ${this.internalTimeoutMillis / 1e3}s, resetting internal state.`;
|
|
406
|
-
this.log.warning(message, { inProgress: [...this.inProgress] });
|
|
407
|
-
this._reset();
|
|
408
|
-
}
|
|
409
|
-
if (this.queueHeadDict.length() > 0 || this.inProgressCount() > 0)
|
|
410
|
-
return false;
|
|
411
|
-
const isHeadConsistent = await this._ensureHeadIsNonEmpty(true);
|
|
412
|
-
return isHeadConsistent && this.queueHeadDict.length() === 0 && this.inProgressCount() === 0;
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* @internal
|
|
416
|
-
*/
|
|
417
|
-
_reset() {
|
|
418
|
-
this.queueHeadDict.clear();
|
|
419
|
-
this.queryQueueHeadPromise = null;
|
|
420
|
-
this.inProgress.clear();
|
|
421
|
-
this.recentlyHandled.clear();
|
|
422
|
-
this.assumedTotalCount = 0;
|
|
423
|
-
this.assumedHandledCount = 0;
|
|
424
|
-
this.requestsCache.clear();
|
|
425
|
-
this.lastActivity = new Date();
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Caches information about request to beware of unneeded addRequest() calls.
|
|
429
|
-
* @param {string} cacheKey
|
|
430
|
-
* @param {object} queueOperationInfo
|
|
431
|
-
* @param {string} queueOperationInfo.requestId
|
|
432
|
-
* @param {boolean} queueOperationInfo.wasAlreadyHandled
|
|
433
|
-
* @ignore
|
|
434
|
-
* @protected
|
|
435
|
-
* @internal
|
|
436
|
-
*/
|
|
437
|
-
_cacheRequest(cacheKey, queueOperationInfo) {
|
|
438
|
-
this.requestsCache.add(cacheKey, {
|
|
439
|
-
id: queueOperationInfo.requestId,
|
|
440
|
-
isHandled: queueOperationInfo.wasAlreadyHandled,
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* We always request more items than is in progress to ensure that something falls into head.
|
|
445
|
-
*
|
|
446
|
-
* @param {boolean} [ensureConsistency=false] If true then query for queue head is retried until queueModifiedAt
|
|
447
|
-
* is older than queryStartedAt by at least API_PROCESSED_REQUESTS_DELAY_MILLIS to ensure that queue
|
|
448
|
-
* head is consistent.
|
|
449
|
-
* @param {number} [limit] How many queue head items will be fetched.
|
|
450
|
-
* @param {number} [iteration] Used when this function is called recursively to limit the recursion.
|
|
451
|
-
* @return {Promise<boolean>} Indicates if queue head is consistent (true) or inconsistent (false).
|
|
452
|
-
* @ignore
|
|
453
|
-
* @protected
|
|
454
|
-
* @internal
|
|
455
|
-
*/
|
|
456
|
-
async _ensureHeadIsNonEmpty(ensureConsistency = false, limit = Math.max(this.inProgressCount() * exports.QUERY_HEAD_BUFFER, exports.QUERY_HEAD_MIN_LENGTH), iteration = 0) {
|
|
457
|
-
// If is nonempty resolve immediately.
|
|
458
|
-
if (this.queueHeadDict.length() > 0)
|
|
459
|
-
return true;
|
|
460
|
-
if (!this.queryQueueHeadPromise) {
|
|
461
|
-
const queryStartedAt = new Date();
|
|
462
|
-
this.queryQueueHeadPromise = this.client
|
|
463
|
-
.listHead({ limit })
|
|
464
|
-
.then(({ items, queueModifiedAt, hadMultipleClients }) => {
|
|
465
|
-
items.forEach(({ id: requestId, uniqueKey }) => {
|
|
466
|
-
// Queue head index might be behind the main table, so ensure we don't recycle requests
|
|
467
|
-
if (this.inProgress.has(requestId) || this.recentlyHandled.get(requestId))
|
|
468
|
-
return;
|
|
469
|
-
this.queueHeadDict.add(requestId, requestId, false);
|
|
470
|
-
this._cacheRequest((0, exports.getRequestId)(uniqueKey), { requestId, wasAlreadyHandled: false });
|
|
471
|
-
});
|
|
472
|
-
// This is needed so that the next call to _ensureHeadIsNonEmpty() will fetch the queue head again.
|
|
473
|
-
this.queryQueueHeadPromise = null;
|
|
474
|
-
return {
|
|
475
|
-
wasLimitReached: items.length >= limit,
|
|
476
|
-
prevLimit: limit,
|
|
477
|
-
queueModifiedAt: new Date(queueModifiedAt),
|
|
478
|
-
queryStartedAt,
|
|
479
|
-
hadMultipleClients,
|
|
480
|
-
};
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
const { queueModifiedAt, wasLimitReached, prevLimit, queryStartedAt, hadMultipleClients } = await this.queryQueueHeadPromise;
|
|
484
|
-
// TODO: I feel this code below can be greatly simplified...
|
|
485
|
-
// If queue is still empty then one of the following holds:
|
|
486
|
-
// - the other calls waiting for this promise already consumed all the returned requests
|
|
487
|
-
// - the limit was too low and contained only requests in progress
|
|
488
|
-
// - the writes from other clients were not propagated yet
|
|
489
|
-
// - the whole queue was processed and we are done
|
|
490
|
-
// If limit was not reached in the call then there are no more requests to be returned.
|
|
491
|
-
if (prevLimit >= consts_1.REQUEST_QUEUE_HEAD_MAX_LIMIT) {
|
|
492
|
-
this.log.warning(`Reached the maximum number of requests in progress: ${consts_1.REQUEST_QUEUE_HEAD_MAX_LIMIT}.`);
|
|
493
|
-
}
|
|
494
|
-
const shouldRepeatWithHigherLimit = this.queueHeadDict.length() === 0
|
|
495
|
-
&& wasLimitReached
|
|
496
|
-
&& prevLimit < consts_1.REQUEST_QUEUE_HEAD_MAX_LIMIT;
|
|
497
|
-
// If ensureConsistency=true then we must ensure that either:
|
|
498
|
-
// - queueModifiedAt is older than queryStartedAt by at least API_PROCESSED_REQUESTS_DELAY_MILLIS
|
|
499
|
-
// - hadMultipleClients=false and this.assumedTotalCount<=this.assumedHandledCount
|
|
500
|
-
const isDatabaseConsistent = queryStartedAt - queueModifiedAt >= exports.API_PROCESSED_REQUESTS_DELAY_MILLIS;
|
|
501
|
-
const isLocallyConsistent = !hadMultipleClients && this.assumedTotalCount <= this.assumedHandledCount;
|
|
502
|
-
// Consistent information from one source is enough to consider request queue finished.
|
|
503
|
-
const shouldRepeatForConsistency = ensureConsistency && !isDatabaseConsistent && !isLocallyConsistent;
|
|
504
|
-
// If both are false then head is consistent and we may exit.
|
|
505
|
-
if (!shouldRepeatWithHigherLimit && !shouldRepeatForConsistency)
|
|
506
|
-
return true;
|
|
507
|
-
// If we are querying for consistency then we limit the number of queries to MAX_QUERIES_FOR_CONSISTENCY.
|
|
508
|
-
// If this is reached then we return false so that empty() and finished() returns possibly false negative.
|
|
509
|
-
if (!shouldRepeatWithHigherLimit && iteration > exports.MAX_QUERIES_FOR_CONSISTENCY)
|
|
510
|
-
return false;
|
|
511
|
-
const nextLimit = shouldRepeatWithHigherLimit
|
|
512
|
-
? Math.round(prevLimit * 1.5)
|
|
513
|
-
: prevLimit;
|
|
514
|
-
// If we are repeating for consistency then wait required time.
|
|
515
|
-
if (shouldRepeatForConsistency) {
|
|
516
|
-
const delayMillis = exports.API_PROCESSED_REQUESTS_DELAY_MILLIS - (Date.now() - queueModifiedAt);
|
|
517
|
-
this.log.info(`Waiting for ${delayMillis}ms before considering the queue as finished to ensure that the data is consistent.`);
|
|
518
|
-
await (0, utils_1.sleep)(delayMillis);
|
|
519
|
-
}
|
|
520
|
-
return this._ensureHeadIsNonEmpty(ensureConsistency, nextLimit, iteration + 1);
|
|
521
|
-
}
|
|
522
|
-
/**
|
|
523
|
-
* Adds a request straight to the queueHeadDict, to improve performance.
|
|
524
|
-
* @private
|
|
525
|
-
*/
|
|
526
|
-
_maybeAddRequestToQueueHead(requestId, forefront) {
|
|
527
|
-
if (forefront) {
|
|
528
|
-
this.queueHeadDict.add(requestId, requestId, true);
|
|
529
|
-
}
|
|
530
|
-
else if (this.assumedTotalCount < exports.QUERY_HEAD_MIN_LENGTH) {
|
|
531
|
-
this.queueHeadDict.add(requestId, requestId, false);
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
/**
|
|
535
|
-
* Removes the queue either from the Apify Cloud storage or from the local database,
|
|
536
|
-
* depending on the mode of operation.
|
|
537
|
-
*
|
|
538
|
-
* @return {Promise<void>}
|
|
539
|
-
*/
|
|
540
|
-
async drop() {
|
|
541
|
-
await this.client.delete();
|
|
542
|
-
const manager = new storage_manager_1.StorageManager(RequestQueue);
|
|
543
|
-
manager.closeStorage(this);
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* Returns the number of handled requests.
|
|
547
|
-
*
|
|
548
|
-
* This function is just a convenient shortcut for:
|
|
549
|
-
*
|
|
550
|
-
* ```javascript
|
|
551
|
-
* const { handledRequestCount } = await queue.getInfo();
|
|
552
|
-
* ```
|
|
553
|
-
*
|
|
554
|
-
* @return {Promise<number>}
|
|
555
|
-
*/
|
|
556
|
-
async handledCount() {
|
|
557
|
-
// NOTE: We keep this function for compatibility with RequestList.handledCount()
|
|
558
|
-
const { handledRequestCount } = await this.getInfo();
|
|
559
|
-
return handledRequestCount;
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* Returns an object containing general information about the request queue.
|
|
563
|
-
*
|
|
564
|
-
* The function returns the same object as the Apify API Client's
|
|
565
|
-
* [getQueue](https://docs.apify.com/api/apify-client-js/latest#ApifyClient-requestQueues)
|
|
566
|
-
* function, which in turn calls the
|
|
567
|
-
* [Get request queue](https://apify.com/docs/api/v2#/reference/request-queues/queue/get-request-queue)
|
|
568
|
-
* API endpoint.
|
|
569
|
-
*
|
|
570
|
-
* **Example:**
|
|
571
|
-
* ```
|
|
572
|
-
* {
|
|
573
|
-
* id: "WkzbQMuFYuamGv3YF",
|
|
574
|
-
* name: "my-queue",
|
|
575
|
-
* userId: "wRsJZtadYvn4mBZmm",
|
|
576
|
-
* createdAt: new Date("2015-12-12T07:34:14.202Z"),
|
|
577
|
-
* modifiedAt: new Date("2015-12-13T08:36:13.202Z"),
|
|
578
|
-
* accessedAt: new Date("2015-12-14T08:36:13.202Z"),
|
|
579
|
-
* totalRequestCount: 25,
|
|
580
|
-
* handledRequestCount: 5,
|
|
581
|
-
* pendingRequestCount: 20,
|
|
582
|
-
* }
|
|
583
|
-
* ```
|
|
584
|
-
*
|
|
585
|
-
* @returns {Promise<RequestQueueInfo>}
|
|
586
|
-
*/
|
|
587
|
-
async getInfo() {
|
|
588
|
-
return this.client.get();
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
exports.RequestQueue = RequestQueue;
|
|
592
|
-
/**
|
|
593
|
-
* Opens a request queue and returns a promise resolving to an instance
|
|
594
|
-
* of the {@link RequestQueue} class.
|
|
595
|
-
*
|
|
596
|
-
* {@link RequestQueue} represents a queue of URLs to crawl, which is stored either on local filesystem or in the cloud.
|
|
597
|
-
* The queue is used for deep crawling of websites, where you start with several URLs and then
|
|
598
|
-
* recursively follow links to other pages. The data structure supports both breadth-first
|
|
599
|
-
* and depth-first crawling orders.
|
|
600
|
-
*
|
|
601
|
-
* For more details and code examples, see the {@link RequestQueue} class.
|
|
602
|
-
*
|
|
603
|
-
* @param {string} [queueIdOrName]
|
|
604
|
-
* ID or name of the request queue to be opened. If `null` or `undefined`,
|
|
605
|
-
* the function returns the default request queue associated with the actor run.
|
|
606
|
-
* @param {object} [options]
|
|
607
|
-
* @param {boolean} [options.forceCloud=false]
|
|
608
|
-
* If set to `true` then the function uses cloud storage usage even if the `APIFY_LOCAL_STORAGE_DIR`
|
|
609
|
-
* environment variable is set. This way it is possible to combine local and cloud storage.
|
|
610
|
-
* @returns {Promise<RequestQueue>}
|
|
611
|
-
* @memberof module:Apify
|
|
612
|
-
* @name openRequestQueue
|
|
613
|
-
* @function
|
|
614
|
-
*/
|
|
615
|
-
const openRequestQueue = async (queueIdOrName, options = {}) => {
|
|
616
|
-
(0, ow_1.default)(queueIdOrName, ow_1.default.optional.string);
|
|
617
|
-
(0, ow_1.default)(options, ow_1.default.object.exactShape({
|
|
618
|
-
forceCloud: ow_1.default.optional.boolean,
|
|
619
|
-
}));
|
|
620
|
-
const manager = new storage_manager_1.StorageManager(RequestQueue);
|
|
621
|
-
return manager.openStorage(queueIdOrName, options);
|
|
622
|
-
};
|
|
623
|
-
exports.openRequestQueue = openRequestQueue;
|
|
624
|
-
/**
|
|
625
|
-
* @typedef RequestQueueInfo
|
|
626
|
-
* @property {string} id
|
|
627
|
-
* @property {string} name
|
|
628
|
-
* @property {string} userId
|
|
629
|
-
* @property {Date} createdAt
|
|
630
|
-
* @property {Date} modifiedAt
|
|
631
|
-
* @property {Date} accessedAt
|
|
632
|
-
* @property {number} totalRequestCount
|
|
633
|
-
* @property {number} handledRequestCount
|
|
634
|
-
* @property {number} pendingRequestCount
|
|
635
|
-
*/
|
|
636
|
-
//# sourceMappingURL=request_queue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request_queue.js","sourceRoot":"","sources":["../../src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