1
0
Fork 0

Update ships status at the end of the nav cooldown

This commit is contained in:
Julien Dessaux 2023-06-06 23:45:25 +02:00
parent 1853bd1268
commit 458d08626f
Signed by: adyxax
GPG key ID: F92E51B86E07177E
2 changed files with 8 additions and 0 deletions

View file

@ -65,6 +65,12 @@ function send_this(data) {
.then(response => response.json())
.then(async response => {
switch(response.error?.code) {
//case 401: // 401 means a server reset happened
// close database file
// rm database file
// logrotate
// spawnSync
// break;
case 429: // 429 means rate limited, let's hold back for 10 seconds
await sleep(10000);
queue.enqueue(data, 1);

View file

@ -61,6 +61,8 @@ export async function navigate(ctx) {
dbShips.setShipNav(ctx.symbol, response.data.nav);
const delay = new Date(response.data.nav.route.arrival) - new Date();
await api.sleep(delay);
response.data.nav.status = 'IN_ORBIT';
dbShips.setShipNav(ctx.symbol, response.data.nav);
return response;
}