@comunica/actor-init-query 2.2.2-alpha.11.0 → 2.2.2-alpha.12.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.
@@ -124,6 +124,7 @@
124
124
  "httpIncludeCredentials": "@comunica/bus-http:include-credentials",
125
125
  "httpAuth": "@comunica/bus-http:auth",
126
126
  "httpTimeout": "@comunica/bus-http:http-timeout",
127
+ "httpBodyTimeout": "@comunica/bus-http:http-body-timeout",
127
128
  "fetch": "@comunica/bus-http:fetch",
128
129
  "readOnly": "@comunica/bus-query-operation:readOnly",
129
130
  "extensionFunctions": "@comunica/actor-init-query:extensionFunctions",
@@ -125,6 +125,7 @@
125
125
  "httpIncludeCredentials": "@comunica/bus-http:include-credentials",
126
126
  "httpAuth": "@comunica/bus-http:auth",
127
127
  "httpTimeout": "@comunica/bus-http:http-timeout",
128
+ "httpBodyTimeout": "@comunica/bus-http:http-body-timeout",
128
129
  "fetch": "@comunica/bus-http:fetch",
129
130
  "readOnly": "@comunica/bus-query-operation:readOnly",
130
131
  "extensionFunctions": "@comunica/actor-init-query:extensionFunctions",
@@ -47,6 +47,10 @@
47
47
  "@id": "caiq:components/HttpServiceSparqlEndpoint.jsonld#IHttpServiceSparqlEndpointArgs__member_invalidateCacheBeforeQuery",
48
48
  "memberFieldName": "invalidateCacheBeforeQuery"
49
49
  },
50
+ {
51
+ "@id": "caiq:components/HttpServiceSparqlEndpoint.jsonld#IHttpServiceSparqlEndpointArgs__member_freshWorkerPerQuery",
52
+ "memberFieldName": "freshWorkerPerQuery"
53
+ },
50
54
  {
51
55
  "@id": "caiq:components/HttpServiceSparqlEndpoint.jsonld#IHttpServiceSparqlEndpointArgs__member_moduleRootPath",
52
56
  "memberFieldName": "moduleRootPath"
@@ -98,6 +98,7 @@ export interface IActorInitQueryBaseArgs extends IActorInitArgs {
98
98
  * "httpIncludeCredentials": "@comunica/bus-http:include-credentials",
99
99
  * "httpAuth": "@comunica/bus-http:auth",
100
100
  * "httpTimeout": "@comunica/bus-http:http-timeout",
101
+ * "httpBodyTimeout": "@comunica/bus-http:http-body-timeout",
101
102
  * "fetch": "@comunica/bus-http:fetch",
102
103
  * "readOnly": "@comunica/bus-query-operation:readOnly",
103
104
  * "extensionFunctions": "@comunica/actor-init-query:extensionFunctions",
@@ -17,6 +17,7 @@ export declare class HttpServiceSparqlEndpoint {
17
17
  readonly port: number;
18
18
  readonly workers: number;
19
19
  readonly invalidateCacheBeforeQuery: boolean;
20
+ readonly freshWorkerPerQuery: boolean;
20
21
  constructor(args: IHttpServiceSparqlEndpointArgs);
21
22
  /**
22
23
  * Starts the server
@@ -108,6 +109,7 @@ export interface IHttpServiceSparqlEndpointArgs extends IDynamicQueryEngineOptio
108
109
  port?: number;
109
110
  workers?: number;
110
111
  invalidateCacheBeforeQuery?: boolean;
112
+ freshWorkerPerQuery?: boolean;
111
113
  moduleRootPath: string;
112
114
  defaultConfigPath: string;
113
115
  }
@@ -23,6 +23,7 @@ class HttpServiceSparqlEndpoint {
23
23
  this.port = args.port ?? 3000;
24
24
  this.workers = args.workers ?? 1;
25
25
  this.invalidateCacheBeforeQuery = Boolean(args.invalidateCacheBeforeQuery);
26
+ this.freshWorkerPerQuery = Boolean(args.freshWorkerPerQuery);
26
27
  this.engine = new __1.QueryEngineFactoryBase(args.moduleRootPath, args.defaultConfigPath, actorInitQuery => new __1.QueryEngineBase(actorInitQuery)).create(args);
27
28
  }
28
29
  /**
@@ -90,6 +91,7 @@ class HttpServiceSparqlEndpoint {
90
91
  exit(1);
91
92
  }
92
93
  const invalidateCacheBeforeQuery = args.invalidateCache;
94
+ const freshWorkerPerQuery = args.freshWorker;
93
95
  const port = args.port;
94
96
  const timeout = args.timeout * 1000;
95
97
  const workers = args.workers;
@@ -100,6 +102,7 @@ class HttpServiceSparqlEndpoint {
100
102
  configPath,
101
103
  context,
102
104
  invalidateCacheBeforeQuery,
105
+ freshWorkerPerQuery,
103
106
  moduleRootPath,
104
107
  mainModulePath: moduleRootPath,
105
108
  port,
@@ -383,6 +386,8 @@ class HttpServiceSparqlEndpoint {
383
386
  */
384
387
  stopResponse(response, eventEmitter) {
385
388
  response.on('close', killClient);
389
+ // eslint-disable-next-line @typescript-eslint/no-this-alias,consistent-this
390
+ const self = this;
386
391
  function killClient() {
387
392
  if (eventEmitter) {
388
393
  // Remove all listeners so we are sure no more write calls are made
@@ -395,6 +400,11 @@ class HttpServiceSparqlEndpoint {
395
400
  catch {
396
401
  // Do nothing
397
402
  }
403
+ // Kill the worker if we want fresh workers per query
404
+ if (self.freshWorkerPerQuery) {
405
+ // eslint-disable-next-line unicorn/no-process-exit
406
+ process.exit(9);
407
+ }
398
408
  }
399
409
  }
400
410
  /**
@@ -107,6 +107,10 @@ class CliArgsHandlerBase {
107
107
  type: 'number',
108
108
  describe: 'HTTP requests timeout in milliseconds',
109
109
  },
110
+ httpBodyTimeout: {
111
+ type: 'boolean',
112
+ describe: 'Makes the HTTP timeout take into account the response body stream read',
113
+ },
110
114
  unionDefaultGraph: {
111
115
  type: 'boolean',
112
116
  describe: 'If the default graph should also contain the union of all named graphs',
@@ -176,6 +180,13 @@ class CliArgsHandlerBase {
176
180
  if (args.httpTimeout) {
177
181
  context[context_entries_1.KeysHttp.httpTimeout.name] = args.httpTimeout;
178
182
  }
183
+ // Define HTTP body timeout
184
+ if (args.httpBodyTimeout) {
185
+ if (!args.httpTimeout) {
186
+ throw new Error('The --httpBodyTimeout option requires the --httpTimeout option to be set');
187
+ }
188
+ context[context_entries_1.KeysHttp.httpBodyTimeout.name] = args.httpBodyTimeout;
189
+ }
179
190
  // Define union default graph
180
191
  if (args.unionDefaultGraph) {
181
192
  context[context_entries_1.KeysQueryOperation.unionDefaultGraph.name] = true;
@@ -48,6 +48,11 @@ class CliArgsHandlerHttp {
48
48
  describe: 'Enable cache invalidation before each query execution',
49
49
  default: false,
50
50
  },
51
+ freshWorker: {
52
+ type: 'boolean',
53
+ describe: 'Kills the worker after each query execution',
54
+ default: false,
55
+ },
51
56
  })
52
57
  .check(args => {
53
58
  if (args.version) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comunica/actor-init-query",
3
- "version": "2.2.2-alpha.11.0",
3
+ "version": "2.2.2-alpha.12.0",
4
4
  "description": "A query init actor",
5
5
  "lsd:module": true,
6
6
  "main": "lib/index.js",
@@ -31,19 +31,19 @@
31
31
  "lib/**/*.js"
32
32
  ],
33
33
  "dependencies": {
34
- "@comunica/actor-http-proxy": "2.2.2-alpha.11.0",
35
- "@comunica/bus-context-preprocess": "2.2.2-alpha.11.0",
36
- "@comunica/bus-http-invalidate": "2.2.2-alpha.11.0",
37
- "@comunica/bus-init": "2.2.2-alpha.11.0",
38
- "@comunica/bus-optimize-query-operation": "2.2.2-alpha.11.0",
39
- "@comunica/bus-query-operation": "2.2.2-alpha.11.0",
40
- "@comunica/bus-query-parse": "2.2.2-alpha.11.0",
41
- "@comunica/bus-query-result-serialize": "2.2.2-alpha.11.0",
42
- "@comunica/context-entries": "2.2.2-alpha.11.0",
43
- "@comunica/core": "2.2.2-alpha.11.0",
44
- "@comunica/logger-pretty": "2.2.2-alpha.11.0",
45
- "@comunica/runner": "2.2.2-alpha.11.0",
46
- "@comunica/types": "2.2.2-alpha.11.0",
34
+ "@comunica/actor-http-proxy": "2.2.2-alpha.12.0",
35
+ "@comunica/bus-context-preprocess": "2.2.2-alpha.12.0",
36
+ "@comunica/bus-http-invalidate": "2.2.2-alpha.12.0",
37
+ "@comunica/bus-init": "2.2.2-alpha.12.0",
38
+ "@comunica/bus-optimize-query-operation": "2.2.2-alpha.12.0",
39
+ "@comunica/bus-query-operation": "2.2.2-alpha.12.0",
40
+ "@comunica/bus-query-parse": "2.2.2-alpha.12.0",
41
+ "@comunica/bus-query-result-serialize": "2.2.2-alpha.12.0",
42
+ "@comunica/context-entries": "2.2.2-alpha.12.0",
43
+ "@comunica/core": "2.2.2-alpha.12.0",
44
+ "@comunica/logger-pretty": "2.2.2-alpha.12.0",
45
+ "@comunica/runner": "2.2.2-alpha.12.0",
46
+ "@comunica/types": "2.2.2-alpha.12.0",
47
47
  "@rdfjs/types": "*",
48
48
  "@types/yargs": "^17.0.2",
49
49
  "asynciterator": "^3.4.0",
@@ -62,5 +62,5 @@
62
62
  "browser": {
63
63
  "./lib/index.js": "./lib/index-browser.js"
64
64
  },
65
- "gitHead": "b122c1ac9a3382a65812c843727d752ad21d4846"
65
+ "gitHead": "399067ba332379a62a0d82782b5930f2925e262b"
66
66
  }