Skip to content

Commit 51ec148

Browse files
Rename from refresh to invalidate
1 parent d8a4848 commit 51ec148

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Options:
6868
--outputRaw Destination for the raw JSON output file [string]
6969
--metadata Load query metadata files (*.metadata.json) and enable
7070
sequence aggregation [boolean] [default: false]
71-
--refreshAfterQuerySet Send a cache refresh request after each query set
71+
--invalidateCacheAfterQuerySet Send a cache invalidation request after each query set
7272
execution [boolean] [default: false]
7373
--timeout Timeout value in seconds to use for individual queries [number]
7474
----help
@@ -126,8 +126,8 @@ async function executeQueries(pathToQueries, pathToOutputCsv) {
126126

127127
To enable sequence metadata from the CLI, add `--metadata`. Raw JSON output is
128128
only written when `--outputRaw` is provided, or automatically to
129-
`./output-raw.json` when `--metadata` is enabled. Cache refresh requests are
130-
disabled by default and can be enabled with `--refreshAfterQuerySet`.
129+
`./output-raw.json` when `--metadata` is enabled. Cache invalidation requests are
130+
disabled by default and can be enabled with `--invalidateCacheAfterQuerySet`.
131131

132132
## Docker
133133

bin/sparql-benchmark-runner.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ async function main(): Promise<void> {
7979
default: false,
8080
description: 'Load query metadata files (*.metadata.json) and enable sequence aggregation',
8181
},
82-
refreshAfterQuerySet: {
82+
invalidateCacheAfterQuerySet: {
8383
type: 'boolean',
8484
default: false,
85-
description: 'Send a cache refresh request after each query set execution',
85+
description: 'Send a cache invalidation request after each query set execution',
8686
},
8787

8888
timeout: {
@@ -107,7 +107,7 @@ async function main(): Promise<void> {
107107
timeout: args.timeout,
108108
availabilityCheckTimeout: 1_000,
109109
logger,
110-
resetCacheBetweenSetExecutions: args.refreshAfterQuerySet,
110+
invalidateCacheBetweenSetExecutions: args.invalidateCacheAfterQuerySet,
111111
});
112112

113113
const results: IRunResult = await runner.run();

lib/SparqlBenchmarkRunner.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class SparqlBenchmarkRunner {
2323
protected readonly logger?: (message: string) => void;
2424
protected readonly resultAggregator: IResultAggregator;
2525
protected readonly availabilityCheckTimeout: number;
26-
protected readonly sendResetSignalBetweenQuerySets: boolean;
26+
protected readonly invalidateCacheBetweenSetExecutions: boolean;
2727
public readonly endpointFetcher: SparqlEndpointFetcher;
2828

2929
public constructor(options: ISparqlBenchmarkRunnerArgs) {
@@ -39,7 +39,7 @@ export class SparqlBenchmarkRunner {
3939
this.requestDelay = options.requestDelay;
4040
this.bindingsHashAlgorithm = 'md5';
4141
this.availabilityCheckTimeout = options.availabilityCheckTimeout ?? 10_000;
42-
this.sendResetSignalBetweenQuerySets = options.resetCacheBetweenSetExecutions ?? false;
42+
this.invalidateCacheBetweenSetExecutions = options.invalidateCacheBetweenSetExecutions ?? false;
4343
this.endpointFetcher = new SparqlEndpointFetcher({
4444
additionalUrlParams: options.additionalUrlParams,
4545
timeout: options.timeout,
@@ -132,14 +132,14 @@ export class SparqlBenchmarkRunner {
132132
}
133133

134134
// Trigger the worker restart after completing the query set execution
135-
if (this.sendResetSignalBetweenQuerySets) {
136-
this.log(`Sending cache refresh signal to trigger worker restart.`);
135+
if (this.invalidateCacheBetweenSetExecutions) {
136+
this.log(`Sending cache invalidation signal to trigger worker restart.`);
137137
try {
138-
const refreshHeaders = new Headers();
139-
refreshHeaders.set('x-comunica-refresh-cache', 'true');
138+
const invalidationHeaders = new Headers();
139+
invalidationHeaders.set('x-comunica-refresh-cache', 'true');
140140
await fetch(this.endpoint, {
141141
method: 'GET',
142-
headers: refreshHeaders,
142+
headers: invalidationHeaders,
143143
});
144144
} catch {
145145
// Suppress error: The server terminates the connection forcefully during shutdown.
@@ -351,7 +351,7 @@ export interface ISparqlBenchmarkRunnerArgs {
351351
/**
352352
* If the engine should reset the cache between executions
353353
*/
354-
resetCacheBetweenSetExecutions?: boolean;
354+
invalidateCacheBetweenSetExecutions?: boolean;
355355
/**
356356
* The delay between subsequent requests sent to the server.
357357
*/

test/SparqlBenchmarkRunner-test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,21 +468,21 @@ describe('SparqlBenchmarkRunner', () => {
468468
expect(results[4]).not.toHaveProperty('template');
469469
});
470470

471-
it('sends cache refresh requests only when enabled', async() => {
471+
it('sends cache invalidation requests only when enabled', async() => {
472472
runner = new SparqlBenchmarkRunner({
473473
endpoint,
474474
querySets,
475475
replication,
476476
warmup,
477477
logger,
478-
resetCacheBetweenSetExecutions: true,
478+
invalidateCacheBetweenSetExecutions: true,
479479
});
480480

481481
await runner.executeAllQueries(replication, false);
482482

483483
const queryExecutions = replication * Object.values(querySets).flatMap(qs => qs).length;
484-
const refreshExecutions = replication * Object.keys(querySets).length;
485-
expect(fetch).toHaveBeenCalledTimes(queryExecutions + refreshExecutions);
484+
const invalidateExecutions = replication * Object.keys(querySets).length;
485+
expect(fetch).toHaveBeenCalledTimes(queryExecutions + invalidateExecutions);
486486
const lastCall = jest.mocked(fetch).mock.calls.at(-1);
487487
expect(lastCall?.[0]).toBe(endpoint);
488488
expect(lastCall?.[1]).toMatchObject({ method: 'GET' });

0 commit comments

Comments
 (0)