Update ships status at the end of the nav cooldown
This commit is contained in:
parent
1853bd1268
commit
458d08626f
2 changed files with 8 additions and 0 deletions
|
@ -65,6 +65,12 @@ function send_this(data) {
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(async response => {
|
.then(async response => {
|
||||||
switch(response.error?.code) {
|
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
|
case 429: // 429 means rate limited, let's hold back for 10 seconds
|
||||||
await sleep(10000);
|
await sleep(10000);
|
||||||
queue.enqueue(data, 1);
|
queue.enqueue(data, 1);
|
||||||
|
|
|
@ -61,6 +61,8 @@ export async function navigate(ctx) {
|
||||||
dbShips.setShipNav(ctx.symbol, response.data.nav);
|
dbShips.setShipNav(ctx.symbol, response.data.nav);
|
||||||
const delay = new Date(response.data.nav.route.arrival) - new Date();
|
const delay = new Date(response.data.nav.route.arrival) - new Date();
|
||||||
await api.sleep(delay);
|
await api.sleep(delay);
|
||||||
|
response.data.nav.status = 'IN_ORBIT';
|
||||||
|
dbShips.setShipNav(ctx.symbol, response.data.nav);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue