Skip to content

Commit

Permalink
Update dependancies
Browse files Browse the repository at this point in the history
It seems like there is now a non-beta version of the zeromq package that is compatible with the EDDN output (or maybe the EDDN service has been updated, I'm not sure).

Either way tested this and it seems to work without having to use an older beta release now.

I've also explicitly specific the version of Node.js used in production (and consequently have tested against).
  • Loading branch information
iaincollins committed Sep 24, 2024
1 parent 364da14 commit a49cc0f
Show file tree
Hide file tree
Showing 4 changed files with 2,725 additions and 472 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ generates reports from the data (e.g. summaries of commodity supply and demand
and trade reports for different regions) and provides access to the data via
the [Ardent API](https://github.com/iaincollins/ardent-api) and raw data dumps.

## Notes

This software assumes an internet connection as it attempts to connect to the
the EDDN (Elite Dangerous Data Network) ZeroMQ instance at
tcp://eddn.edcd.io:9500 at startup to receive a data stream.

Because of this, and other dependancies, it is build against Node.js v18.x,
an older LTS release that is end-of-life 2025-04-30 and may not work with
other versions of Node.js.

After doing `npm install` you can run the service with `npm start`.

You may need to run additional commands like `npm run commodity-stats` and
`npm run database-stats` to generate at least once to avoid errors, but the
process will run these automatically if left running for long enough (they
are scheduled tasks that run periodically).

## Credits

_This software would not be possible without work from dozens of enthusiasts
Expand Down
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ if (SAVE_PAYLOAD_EXAMPLES === true &&
})
})

// Generate high level db stats like total star systems, trade orders, etc.
// Takes about 30 seconds to run.
// @TODO Replace with triggers on tables?
// Generate high level stats like total star systems, trade orders, etc.
// Takes about 20s to run in test but 1m 30s in production due to load.
// @TODO Could maybe be real time if replaced with triggers on tables,
// or a best-effort internal counter that tracks changes between updates.
cron.schedule('0 0 * * * *', () => {
exec('npm run database-stats', (error, stdout, stderr) => {
if (error) console.error(error)
Expand Down Expand Up @@ -218,7 +219,7 @@ function printStats () {
`* Trade updates in last 7 days: ${stats.trade.updatedInLast7Days.toLocaleString()}\n` +
`* Trade updates in last 30 days: ${stats.trade.updatedInLast30Days.toLocaleString()}\n` +
`* Unique commodities: ${stats.trade.uniqueCommodities.toLocaleString()}\n` +
`Stats last updated: ${stats.timestamp} (updated every 15 minutes)`
`Stats last updated: ${stats.timestamp}`
: 'Stats not generated yet')
} catch (e) {
return 'Error: Could not load stats'
Expand Down
Loading

0 comments on commit a49cc0f

Please sign in to comment.