Skip to content

Commit

Permalink
chore(env): add env vars for data verification workout count and stre…
Browse files Browse the repository at this point in the history
…am timeout

These give us flexiblity when setting up integration tests. Not exposing them on docker-compose as data verification is not enabled by default.
  • Loading branch information
dtfiedler authored and djwhitt committed Jan 24, 2025
1 parent a070b48 commit ffd0dc8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
5 changes: 5 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@ export const BACKGROUND_DATA_VERIFICATION_WORKER_COUNT = +env.varOrDefault(
'1',
);

export const BACKGROUND_DATA_VERIFICATION_STREAM_TIMEOUT_MS = +env.varOrDefault(
'BACKGROUND_DATA_VERIFICATION_STREAM_TIMEOUT_MS',
'1000 * 30', // 30 seconds
);

//
// GraphQL
//
Expand Down
7 changes: 2 additions & 5 deletions src/workers/data-verification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ import { ContiguousDataIndex, ContiguousDataSource } from '../types.js';
import { DataRootComputer } from '../lib/data-root.js';
import * as config from '../config.js';

const DEFAULT_STREAM_TIMEOUT = 1000 * 30; // 30 seconds
const DEFAULT_WORKER_COUNT = 1;

export class DataVerificationWorker {
// Dependencies
private log: winston.Logger;
Expand All @@ -41,8 +38,8 @@ export class DataVerificationWorker {
log,
contiguousDataIndex,
contiguousDataSource,
workerCount = DEFAULT_WORKER_COUNT,
streamTimeout = DEFAULT_STREAM_TIMEOUT,
workerCount = config.BACKGROUND_DATA_VERIFICATION_WORKER_COUNT,
streamTimeout = config.BACKGROUND_DATA_VERIFICATION_STREAM_TIMEOUT_MS,
interval = config.BACKGROUND_DATA_VERIFICATION_INTERVAL_SECONDS * 1000,
}: {
log: winston.Logger;
Expand Down
1 change: 0 additions & 1 deletion test/end-to-end/data-sources.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ describe('DataSources', () => {

localStack = await new LocalstackContainer('localstack/localstack:3')
.withNetwork(network as any)
.withName('localstack')
.start();

// Create a bucket
Expand Down
5 changes: 2 additions & 3 deletions test/end-to-end/indexing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ describe('Indexing', function () {
});
dataDb = new Sqlite(`${projectRootPath}/data/sqlite/data.db`);

// queue the bundele tx to populate the data root
// queue the bundle tx to populate the data root
await axios({
method: 'post',
url: 'http://localhost:4000/ar-io/admin/queue-tx',
Expand All @@ -891,11 +891,10 @@ describe('Indexing', function () {
data: { id: bundleId },
});

// queue the bundle
// queue the bundle to index the data items, there should be 79 data items in this bundle, once the root tx is indexed and verified all associated data items should be marked as verified
await axios.post(
'http://localhost:4000/ar-io/admin/queue-bundle',
{
// there are 79 data items in this bundle, once the root tx is indexed and verified the data items will be verified
id: bundleId,
},
{
Expand Down

0 comments on commit ffd0dc8

Please sign in to comment.