Skip to content

Commit 0545e87

Browse files
committed
perf(api): use conditional check for server readiness
1 parent 427b592 commit 0545e87

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/index.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,28 @@ await createAdminUser();
2626

2727
logger(LogLevel.Info, `minimum frontend client version set to ${API_VAR.MINIMUM_APP_VERSION}`);
2828

29-
const start = performance.now();
29+
app.listen(PORT, async () => {
30+
logger(LogLevel.Info, `server up and running on port ${PORT} (v${APP_VERSION})`);
3031

31-
logger(LogLevel.Info, `loading firebase data`, { service: 'firebase' });
32+
const start = performance.now();
3233

33-
await UsersList.load();
34-
await CongregationsList.load();
35-
await CongregationsList.cleanupTasks();
36-
await Flags.load();
37-
await Installation.load();
34+
logger(LogLevel.Info, `loading firebase data`, { service: 'firebase' });
3835

39-
// non-blocking calls
40-
UsersList.removeOutdatedSessions();
36+
await UsersList.load();
37+
await CongregationsList.load();
38+
await CongregationsList.cleanupTasks();
39+
await Flags.load();
40+
await Installation.load();
4141

42-
const end = performance.now();
43-
const durationMs = end - start;
44-
const totalSeconds = Math.floor(durationMs / 1000);
45-
const minutes = Math.floor(totalSeconds / 60);
42+
// non-blocking calls
43+
UsersList.removeOutdatedSessions();
4644

47-
logger(LogLevel.Info, `loading firebase completed`, { service: 'firebase', duration: minutes });
45+
const end = performance.now();
46+
const durationMs = end - start;
47+
const totalSeconds = Math.floor(durationMs / 1000);
48+
const minutes = Math.floor(totalSeconds / 60);
4849

49-
app.listen(PORT, async () => {
50-
logger(LogLevel.Info, `server up and running on port ${PORT} (v${APP_VERSION})`);
50+
logger(LogLevel.Info, `loading firebase completed`, { service: 'firebase', duration: minutes });
5151

5252
API_VAR.IS_SERVER_READY = true;
5353
});

0 commit comments

Comments
 (0)