Connection: "close" in HTTP headers in fetchWebServiceMap in MapComponent.js
This commit is contained in:
@@ -197,9 +197,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
|
||||
//---------------------------------------------------------------
|
||||
|
||||
useEffect(() => {
|
||||
/* useEffect(() => {
|
||||
fetchGisStatusStations(12, 484); // Beispielaufruf mit idMap = 10 und idUser = 484
|
||||
}, []);
|
||||
}, []); */
|
||||
|
||||
useEffect(() => {
|
||||
const params = new URL(window.location.href).searchParams;
|
||||
@@ -246,7 +246,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
const fetchOptions = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Connection: "keep-alive", // Keep-Alive-Header hinzufügen
|
||||
Connection: "close", // Keep-Alive-Header hinzufügen
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -17,15 +17,15 @@ const useLineData = (webserviceGisLinesStatusUrl, setLineStatusData) => {
|
||||
const response1 = await fetch(webserviceGisLinesStatusUrl); // original
|
||||
//const response1 = await fetch(`${SERVER_URL}:3000/api/talas_v5_DB/gisLines/webserviceGisLinesStatusUrlMock`); //von original kopiert
|
||||
const data1 = await response1.json();
|
||||
console.log("Daten empfangen data1:", data1);
|
||||
//console.log("Daten empfangen data1:", data1);
|
||||
const response2 = await fetch(`${SERVER_URL}:3000/api/talas_v5_DB/gisLines/readGisLines`);
|
||||
//const response2 = await fetch(`${SERVER_URL}:3000/api/talas_v5_DB/gisLines/readGisLinesMock`);
|
||||
const data2 = await response2.json();
|
||||
console.log("Daten empfangen data2:", data2);
|
||||
//console.log("Daten empfangen data2:", data2);
|
||||
const response3 = await fetch(`${SERVER_URL}:3000/api/talas_v5_DB/device/getAllStationsNames`);
|
||||
//const response3 = await fetch(`${SERVER_URL}:3000/api/talas_v5_DB/device/getAllStationsNamesMock`);
|
||||
const namesData = await response3.json();
|
||||
console.log("Daten empfangen namesData:", namesData);
|
||||
//console.log("Daten empfangen namesData:", namesData);
|
||||
|
||||
const colorsByModule = {};
|
||||
const newTooltipContents = {};
|
||||
@@ -36,7 +36,7 @@ const useLineData = (webserviceGisLinesStatusUrl, setLineStatusData) => {
|
||||
|
||||
// Sortiere die Meldungen nach Level, damit die höchste Priorität (kleinster Level) zuerst kommt
|
||||
const sortedStatis = [...data1.Statis].sort((a, b) => a.Level - b.Level);
|
||||
console.log("Sortierte Daten:", sortedStatis);
|
||||
//console.log("Sortierte Daten:", sortedStatis);
|
||||
|
||||
// Filtere Objekte mit gleichem IdLD und Modul, und Level > 0, und entferne die Objekte mit dem höchsten Level
|
||||
const filteredStatis = [];
|
||||
@@ -56,7 +56,7 @@ const useLineData = (webserviceGisLinesStatusUrl, setLineStatusData) => {
|
||||
}
|
||||
});
|
||||
|
||||
console.log("Gefilterte Daten (Objekte mit höchstem Level entfernt):", filteredStatis);
|
||||
//console.log("Gefilterte Daten (Objekte mit höchstem Level entfernt):", filteredStatis);
|
||||
|
||||
filteredStatis.forEach((statis) => {
|
||||
const key = `${statis.IdLD}-${statis.Modul}`;
|
||||
@@ -227,7 +227,7 @@ function logGroupedData(statisList) {
|
||||
}
|
||||
});
|
||||
|
||||
console.log("Aggregierte und gruppierte Daten (gefiltert):", formattedData);
|
||||
//console.log("Aggregierte und gruppierte Daten (gefiltert):", formattedData);
|
||||
}
|
||||
|
||||
export default useLineData;
|
||||
|
||||
@@ -34,7 +34,12 @@ export const fetchGisStatusStations = async (idMap, idUser) => {
|
||||
// Verwende das Timeout für die API-Anfrage
|
||||
const response = await fetchWithTimeout(
|
||||
`${SERVER_URL}/talas5/ClientData/WebServiceMap.asmx/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`,
|
||||
null,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
Connection: "close", // Dieser Header stellt sicher, dass die Verbindung nach dem Abruf geschlossen wird
|
||||
},
|
||||
},
|
||||
5000 // Timeout auf 5 Sekunden gesetzt
|
||||
);
|
||||
|
||||
@@ -140,7 +145,7 @@ export const fetchUserRights = async () => {
|
||||
const response = await fetch(`${process.env.NEXT_PUBLIC_SERVER_URL}/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap=${config.idMap}&idUser=${config.idUser}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Connection: "keep-alive", // Keep-Alive Header hinzufügen
|
||||
Connection: "close",
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export const createAndSetDevices = async (systemId, setMarkersFunction, GisSyste
|
||||
let requestCount = localStorage.getItem("gisStationsStaticRequestCount-createDevice") || 0;
|
||||
requestCount++;
|
||||
localStorage.setItem("gisStationsStaticRequestCount-createDevice", requestCount);
|
||||
console.log(`config.mapGisStationsStaticDistrictUrl in createAndSetDevice wurde ${requestCount} Mal aufgerufen.`);
|
||||
//console.log(`config.mapGisStationsStaticDistrictUrl in createAndSetDevice wurde ${requestCount} Mal aufgerufen.`);
|
||||
|
||||
const response1 = await fetch(config.mapGisStationsStaticDistrictUrl);
|
||||
const jsonResponse = await response1.json();
|
||||
|
||||
Reference in New Issue
Block a user