More performance improvements
This commit is contained in:
13
index.js
13
index.js
@@ -141,13 +141,16 @@ app.get('/weather', async (req, res) => {
|
||||
timeFormat
|
||||
};
|
||||
|
||||
// Generate session ID for logging
|
||||
const sessionId = Math.floor(Math.random() * 100000);
|
||||
|
||||
let lateGeocodePromise = null;
|
||||
let geocodeDataPromise = null;
|
||||
let initialUrl = 'data:text/html,<html><body style="margin:0;padding:0;background:#000"></body></html>';
|
||||
|
||||
if (city && city !== 'Toronto, ON, CAN') {
|
||||
// Start geocoding in background - don't wait for it
|
||||
const geocodePromise = geocodeCity(city);
|
||||
const geocodePromise = geocodeCity(city, sessionId);
|
||||
geocodeDataPromise = geocodePromise; // Save for city name overlay
|
||||
|
||||
// Always start with black screen immediately
|
||||
@@ -179,6 +182,10 @@ app.get('/weather', async (req, res) => {
|
||||
|
||||
// Call stream handler with music enabled
|
||||
const { debug = DEBUG_MODE ? 'true' : 'false' } = req.query;
|
||||
|
||||
// Build request path for logging
|
||||
const requestPath = `/weather?city=${encodeURIComponent(city)}`;
|
||||
|
||||
return streamHandler(req, res, {
|
||||
useMusic: true,
|
||||
musicPath: MUSIC_PATH,
|
||||
@@ -188,7 +195,9 @@ app.get('/weather', async (req, res) => {
|
||||
defaultFps: DEFAULT_FPS,
|
||||
screenshotFormat: SCREENSHOT_FORMAT,
|
||||
screenshotQuality: SCREENSHOT_QUALITY,
|
||||
debugMode: debug === 'true'
|
||||
debugMode: debug === 'true',
|
||||
sessionId,
|
||||
requestPath
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user