Skip to content

Commit

Permalink
Merge branch 'hotfix/1.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Frenkii committed Apr 21, 2023
2 parents 859ac51 + 84f52aa commit f283af3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions backend/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import ecfmpService from './services/ecfmp.service';
try {
await cdmService.cleanupPilots();
} catch (error) {
logger.error('error occurred when cleaning up pilots');
logger.error('error occurred when cleaning up pilots', error);
}
}, 10000);

Expand All @@ -53,7 +53,7 @@ import ecfmpService from './services/ecfmp.service';
try {
await cdmService.optimizeBlockAssignments();
} catch (error) {
logger.error('error occurred when optimizing block assignments');
logger.error('error occurred when optimizing block assignments', error);
}
}

Expand Down
4 changes: 2 additions & 2 deletions backend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export default function config(): vacdmConfig {
},

timeframes: {
timeSinceLastSeen: Number(process.env.TIME_LAST_SEEN) * 60 * 1000 ?? 15 * 60 * 1000,
timeSinceInactive: Number(process.env.TIME_INACTIVE) * 60 * 1000 ?? 15 * 60 * 1000,
timeSinceLastSeen: Number(process.env.TIME_LAST_SEEN || 5) * 60 * 1000,
timeSinceInactive: Number(process.env.TIME_INACTIVE || 5) * 60 * 1000
},

eventUrl: process.env.EVENT_URL || 'https://slots.vatsim-germany.org/api/events/',
Expand Down
4 changes: 4 additions & 0 deletions backend/src/services/cdm.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ export async function optimizeBlockAssignments() {
const datafeedData = await datafeedService.getRawDatafeed();

for (let pilot of allPilots) {
console.log(pilot.callsign);

if (pilot.hasBooking) {
continue;
}
Expand All @@ -251,6 +253,8 @@ export async function optimizeBlockAssignments() {

}

console.log('done');

const nowPlusTen = timeUtils.addMinutes(new Date(), 10);

for (let airport of allAirports) {
Expand Down
10 changes: 2 additions & 8 deletions backend/src/services/datafeed.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@ export async function getRawDatafeed(): Promise<VatsimTypes.VatsimDatafeed> {
export async function getFlight(
callsign: string,
datafeed: VatsimTypes.VatsimDatafeed | undefined = undefined
): Promise<VatsimTypes.VatsimPilot> {
): Promise<VatsimTypes.VatsimPilot | undefined> {
try {
if (!datafeed) {
datafeed = await getRawDatafeed();
}

const pilot = datafeed.pilots.find((p) => p.callsign == callsign);

if (!pilot) {
throw new Error('requested flight not online');
}

return pilot;
} catch (error) {
Expand All @@ -36,15 +33,12 @@ export async function getFlight(

export async function getFlightByCid(
cid: number
): Promise<VatsimTypes.VatsimPilot> {
): Promise<VatsimTypes.VatsimPilot | undefined> {
try {
const datafeed = await getRawDatafeed();

const pilot = datafeed.pilots.find((p) => p.cid == cid);

if (!pilot) {
throw new Error('requested Cid not found');
}

return pilot;
} catch (error) {
Expand Down

0 comments on commit f283af3

Please sign in to comment.