Skip to content

Commit 6c8e742

Browse files
committed
fix(eu-data-act): /list HTTP 404 'No files available' is cold-start, not rotation
Right after the user activates a continuous data request the portal returns HTTP 404 with body 'No files available for this request.' on the /list endpoint until the car has actually emitted a dataset (can take 15 min to a few hours). The previous code blanket-treated any 404 as 'data-request rotated' and dropped the cached Identifier, which then triggered a metadata refetch every minute — pointless thrashing while the producer is just sleepy. Now we match the body message and treat that specific 404 as a debug- level no-content-yet event, leaving the Identifier intact. Other 404/400 errors (different body, /metadata endpoint) still trigger the rotation path.
1 parent 8132383 commit 6c8e742

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

main.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6897,18 +6897,29 @@ class VwWeconnect extends utils.Adapter {
68976897
});
68986898
this.euDataActLastDataset[vin] = newest.name;
68996899
} catch (err) {
6900+
const msg = (err && err.message) || "";
69006901
// The lib already retries once on 401/403 internally; if it still fails
69016902
// here the session is genuinely dead and a manual re-login won't help.
6902-
// 404/400 on list/download usually means the data-request was rotated
6903-
// on the portal — drop the cached Identifier so the next refresh
6904-
// re-fetches metadata.
6905-
if (/HTTP (?:404|400)/.test(err.message || "")) {
6903+
//
6904+
// 404 on /list with body "No files available" is the expected cold-
6905+
// start state right after the user activates a continuous data request
6906+
// on the portal — the request itself is fine, the producer just hasn't
6907+
// emitted anything yet. Treat it as "no content yet", not as rotation.
6908+
//
6909+
// 404/400 on /metadata (or /list with a different body) usually means
6910+
// the request was rotated/cancelled on the portal — drop the cached
6911+
// Identifier so the next cycle re-fetches metadata.
6912+
if (/No files available/i.test(msg)) {
6913+
this.log.debug(`EU Data Act: ${vin} no datasets emitted yet (data request just activated?)`);
6914+
return;
6915+
}
6916+
if (/HTTP (?:404|400)/.test(msg)) {
69066917
this.log.warn(
69076918
`EU Data Act: ${vin} data-request seems rotated, will re-fetch metadata next cycle`,
69086919
);
69096920
if (this.euDataActIdentifiers) delete this.euDataActIdentifiers[vin];
69106921
}
6911-
this.log.error(`EU Data Act: status fetch failed for ${vin}: ${err.message || err}`);
6922+
this.log.error(`EU Data Act: status fetch failed for ${vin}: ${msg || err}`);
69126923
}
69136924
}
69146925

0 commit comments

Comments
 (0)