Skip to content

Commit

Permalink
fix: no more search hard limits
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed Feb 29, 2024
1 parent 1c21c0c commit 440bb94
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 9 deletions.
4 changes: 0 additions & 4 deletions server/src/configs/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,6 @@
"__name": "API_SEARCH_SOFT_KM_LIMIT",
"__format": "number"
},
"searchHardKmLimit": {
"__name": "API_SEARCH_HARD_KM_LIMIT",
"__format": "number"
},
"nestHemisphere": "API_NEST_HEMISPHERE",
"gymValidDataLimit": {
"__name": "API_GYM_VALID_DATA_LIMIT",
Expand Down
1 change: 0 additions & 1 deletion server/src/configs/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
"weatherCellLimit": 3,
"searchResultsLimit": 15,
"searchSoftKmLimit": 10,
"searchHardKmLimit": 100,
"nestHemisphere": "north",
"gymValidDataLimit": 30,
"hideOldGyms": false,
Expand Down
4 changes: 0 additions & 4 deletions server/src/services/DbCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const { getBboxFromCenter } = require('./functions/getBbox')
const { getCache } = require('./cache')

const softLimit = config.getSafe('api.searchSoftKmLimit')
const hardLimit = config.getSafe('api.searchHardKmLimit')

/**
* @type {import("@rm/types").DbCheckClass}
Expand Down Expand Up @@ -441,7 +440,6 @@ module.exports = class DbCheck {
let deDuped = []
let count = 0
let distance = softLimit
const max = model === 'Pokemon' ? hardLimit / 2 : hardLimit
const startTime = Date.now()
while (deDuped.length < this.searchLimit) {
const loopTime = Date.now()
Expand Down Expand Up @@ -475,7 +473,6 @@ module.exports = class DbCheck {
)
if (
deDuped.length >= this.searchLimit * 0.5 ||
distance >= max ||
Date.now() - startTime > 2_000
) {
break
Expand All @@ -487,7 +484,6 @@ module.exports = class DbCheck {
} else {
distance += softLimit
}
distance = Math.min(distance, max)
}
if (count > 1) {
log.info(
Expand Down

0 comments on commit 440bb94

Please sign in to comment.