Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/broker drop past from memory #687

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.17.1
v18.20.3
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
"program": "${workspaceFolder}/packages/openactive-broker-microservice/app.js",
"cwd": "${workspaceFolder}/packages/openactive-broker-microservice/",
"env": {
"NODE_APP_INSTANCE": "dev"
"NODE_ENV": "gladstone-booking-facade",
"DEBUG_BROKER_NO_VALIDATE": "true",
},
},
{
Expand Down
8 changes: 8 additions & 0 deletions packages/openactive-broker-microservice/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ If `false` and `broker` and `openactive-integration-tests` are running in separa
"waitForHarvestCompletion": true,
```

### `doNotCacheItemsInThePast`

If `true` will not store child opportunities in the past in memory. This is useful for memory constrained environments.

```json
"doNotCacheItemsInThePast": true,
```

### `loginPagesSelectors`

[CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) which are used to find, in the Booking System's login page the following HTML elements:
Expand Down
6 changes: 5 additions & 1 deletion packages/openactive-broker-microservice/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const {
deleteTestDatasetRoute,
assertUnmatchedCriteriaRoute,
getSampleOpportunitiesRoute,
getDeletedIdsRoute,
onHttpServerError,
startPolling,
} = require('./src/core');
Expand Down Expand Up @@ -90,6 +91,9 @@ app.post('/assert-unmatched-criteria', assertUnmatchedCriteriaRoute);
// Sample Requests endpoint, used to underpin the Postman collection
app.get('/sample-opportunities', getSampleOpportunitiesRoute);

// Get Deleted IDs route
app.get('/get-deleted-ids', getDeletedIdsRoute)

/* Ensure that processing the Dataset Site, and initiating polling on all the
feeds therein, delays the Broker Microservice from being "ready".
Note that this is done before the HTTP server starts listening, to ensure that
Expand Down Expand Up @@ -130,4 +134,4 @@ setTimeout(() => {
logError(`${message}\n`);
throw new Error(message);
}
}, 3600000); // 3600000 ms = 1 hour
}, 86400000); // 86400000 ms = 1 day
7 changes: 3 additions & 4 deletions packages/openactive-broker-microservice/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/openactive-broker-microservice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "OpenActive Broker Microservice",
"main": "app.js",
"scripts": {
"start": "node app.js",
"start": "node --inspect app.js",
"auto-restart": "./auto-restart.sh",
"validate-feeds": "node app.js --validate-only",
"test": "npm run lint && tsc && jest",
Expand All @@ -19,7 +19,7 @@
"@openactive/data-model-validator": "^2.0.78",
"@openactive/data-models": "^2.0.316",
"@openactive/dataset-utils": "^1.0.1",
"@openactive/harvesting-utils": "github:openactive/harvesting-utils#1b2877834055549572fa059a491ac17d306942fd",
"@openactive/harvesting-utils": "github:openactive/harvesting-utils#2231c78",
"@openactive/openactive-openid-browser-automation": "file:../openactive-openid-browser-automation",
"@openactive/openactive-openid-client": "file:../openactive-openid-client",
"@openactive/rpde-validator": "^2.0.20",
Expand Down
2 changes: 2 additions & 0 deletions packages/openactive-broker-microservice/src/broker-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function getBrokerConfig() {
const DO_NOT_HARVEST_ORDERS_FEED = config.has('broker.disableOrdersFeedHarvesting') ? config.get('broker.disableOrdersFeedHarvesting') : false;
const DISABLE_BROKER_TIMEOUT = config.has('broker.disableBrokerMicroserviceTimeout') ? config.get('broker.disableBrokerMicroserviceTimeout') : false;
const LOG_AUTH_CONFIG = config.has('broker.logAuthConfig') ? config.get('broker.logAuthConfig') : false;
const DO_NOT_CACHE_ITEMS_IN_THE_PAST = config.has('broker.doNotCacheItemsInThePast') ? config.get('broker.doNotCacheItemsInThePast') : false;

const BUTTON_SELECTORS = config.has('broker.loginPagesSelectors') ? config.get('broker.loginPagesSelectors') : {
username: "[name='username' i]",
Expand Down Expand Up @@ -88,6 +89,7 @@ function getBrokerConfig() {
VALIDATOR_TMP_DIR,
VALIDATOR_INPUT_TMP_DIR,
BOOKING_PARTNER_IDENTIFIERS,
DO_NOT_CACHE_ITEMS_IN_THE_PAST,
};
}

Expand Down
Loading