Skip to content

Commit

Permalink
re-enable query for all servers
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed Jan 7, 2024
1 parent 21a8214 commit 4201ab5
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,34 @@ export const mapAPIResponseServerListToAppStructure = (
export const fetchServers = async (cached: boolean = true) => {
if (cached) {
const { favorites } = usePersistentServers.getState();
// if (Array.isArray(favorites)) {
// // let's query servers from server list so players have updated data
// for (let i = 0; i < favorites.length; i += 10) {
// setTimeout(() => {
// for (let offset = 0; offset < 10; offset++) {
// if (favorites[i + offset]) {
// queryServer(favorites[i + offset], "favorites", "basic");
// }
// }
// }, 500 + (i % PARALLEL_SERVERS_TO_UPDATE_COUNT) * PARALLEL_SERVERS_TO_UPDATE_TIMER_INTERVAL);
// }
// }
if (Array.isArray(favorites)) {
// let's query servers from server list so players have updated data
for (let i = 0; i < favorites.length; i += 10) {
setTimeout(() => {
for (let offset = 0; offset < 10; offset++) {
if (favorites[i + offset]) {
queryServer(favorites[i + offset], "favorites", "basic");
}
}
}, 500 + (i % PARALLEL_SERVERS_TO_UPDATE_COUNT) * PARALLEL_SERVERS_TO_UPDATE_TIMER_INTERVAL);
}
}

const response = await getCachedList();
useServers.getState().setServers(response.servers);

// Log.debug(response);
// if (Array.isArray(response.servers)) {
// // let's query servers from server list so players have updated data
// for (let i = 0; i < response.servers.length; i += 15) {
// setTimeout(() => {
// for (let offset = 0; offset < 15; offset++) {
// if (response.servers[i + offset])
// queryServer(response.servers[i + offset], "internet", "basic");
// }
// }, 500 + (i / PARALLEL_SERVERS_TO_UPDATE_COUNT) * PARALLEL_SERVERS_TO_UPDATE_TIMER_INTERVAL);
// }
// }
Log.debug(response);
if (Array.isArray(response.servers)) {
// let's query servers from server list so players have updated data
for (let i = 0; i < response.servers.length; i += 15) {
setTimeout(() => {
for (let offset = 0; offset < 15; offset++) {
if (response.servers[i + offset])
queryServer(response.servers[i + offset], "internet", "basic");
}
}, 500 + (i / PARALLEL_SERVERS_TO_UPDATE_COUNT) * PARALLEL_SERVERS_TO_UPDATE_TIMER_INTERVAL);
}
}
}
};

Expand Down

0 comments on commit 4201ab5

Please sign in to comment.