diff options
author | Julien Dessaux | 2023-06-01 01:11:21 +0200 |
---|---|---|
committer | Julien Dessaux | 2023-06-01 01:11:21 +0200 |
commit | 68c457964a02d290f3fe225b090c549d664bb836 (patch) | |
tree | 4b63ee97f5439621536594c59f25b1c35c353b37 /lib/systems.js | |
parent | Reworked the systems handling and caching with sqlite (diff) | |
download | spacetraders-68c457964a02d290f3fe225b090c549d664bb836.tar.gz spacetraders-68c457964a02d290f3fe225b090c549d664bb836.tar.bz2 spacetraders-68c457964a02d290f3fe225b090c549d664bb836.zip |
Another big refactoring
Diffstat (limited to 'lib/systems.js')
-rw-r--r-- | lib/systems.js | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/lib/systems.js b/lib/systems.js index 3cc7c7a..fcbf41a 100644 --- a/lib/systems.js +++ b/lib/systems.js @@ -1,25 +1,6 @@ import * as api from './api.js'; import * as db from '../database/systems.js'; -// Retrieves all systems information, should be called only once after registering -export async function init(ctx) { - if (db.isInit()) { - return; - } - for (let page=1; true; ++page) { - const response = await api.send({endpoint: `/systems?limit=20&page=${page}`, priority:100}); - if (response.error !== undefined) { - throw response; - } - response.data.forEach(system => db.setSystem(system)); - if (response.meta.total <= response.meta.limit * page) { - break; - } - } - console.log('Finished retrieving all systems information'); - db.init(); -} - // Retrieves a shipyard's information for ctx.symbol export async function shipyard(ctx) { const systemSymbol = ctx.symbol.match(/([^-]+-[^-]+)/)[1]; // TODO generalise this extraction |