Skip to content

Commit

Permalink
Merge pull request #940 from 18F/develop
Browse files Browse the repository at this point in the history
Scheduling with Bree library and performance improvements -- Staging
  • Loading branch information
levinmr authored Jan 13, 2025
2 parents 35adcb6 + e2cadd4 commit 2914cd5
Show file tree
Hide file tree
Showing 26 changed files with 1,326 additions and 232 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ The process for adding features to this project is described in

## Local development setup

### Prerequistites
### Prerequisites

* NodeJS > v20.x
* NodeJS > v22.x
* A postgres DB running and/or docker installed

### Install dependencies
Expand Down Expand Up @@ -144,7 +144,7 @@ This file is ignored in the `.gitignore` file and should not be checked in to th
npm start

# running the app with dotenv-cli
dotenv -e .env npm start
npx dotenv -e .env npm start
```

## Configuration
Expand Down
6 changes: 0 additions & 6 deletions deploy/api.sh

This file was deleted.

120 changes: 0 additions & 120 deletions deploy/cron.js

This file was deleted.

6 changes: 0 additions & 6 deletions deploy/daily.sh

This file was deleted.

5 changes: 0 additions & 5 deletions deploy/hourly.sh

This file was deleted.

46 changes: 46 additions & 0 deletions deploy/publisher.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
if (process.env.NODE_ENV !== "production") {
require("dotenv").config();
}

if (process.env.NEW_RELIC_APP_NAME) {
require("newrelic");
}

const logger = require("../src/logger").initialize();
logger.info("===================================");
logger.info("=== STARTING ANALYTICS-REPORTER ===");
logger.info(" Running /deploy/publisher.js");
logger.info("===================================");

// Job Scheduler
const Bree = require("bree");
const bree = new Bree({
logger,
jobs: [
// Runs `../jobs/realtime.js` 1 millisecond after the process starts and
// then every 15 minutes going forward.
{
name: "realtime",
timeout: "1",
interval: "15m",
},
// Runs `../jobs/daily.js` 1 minute after the process starts and then at
// 10:01 AM every day going forward.
{
name: "daily",
timeout: "1m",
interval: "at 10:01 am",
},
// Runs `../jobs/api.js` 2 minutes after the process starts and then at
// 10:02 AM every day going forward.
{
name: "api",
timeout: "2m",
interval: "at 10:02 am",
},
],
});

(async () => {
await bree.start();
})();
5 changes: 0 additions & 5 deletions deploy/realtime.sh

This file was deleted.

Loading

0 comments on commit 2914cd5

Please sign in to comment.