Conversation
| val ip: String?, | ||
| val asn: String?, | ||
| val countryCode: String?, | ||
| val geoIpdb: String?, |
There was a problem hiding this comment.
Why do we need to get the geoIpDb from the engine?
There was a problem hiding this comment.
To determine which version of geoIPDB the engine is currently working with.
af697b7 to
eef3dbc
Compare
eef3dbc to
b5322c8
Compare
geoipdb from path
sdsantos
left a comment
There was a problem hiding this comment.
Some other issues:
a) We're not cleaning old version of the geoIp database after we download an update
b) GeoIP databases will count for storage usaged, but they are not cleared when the clean storage (maybe this is what we want, but just wanted to make sure)
c) The fetch is running on app start, and therefore on any instrumented test we have. It should be disabled for most tests I imagine.
| const val GEOIP_DB_VERSION_DEFAULT: String = "20250801" | ||
| const val GEOIP_DB_REPO: String = "aanorbel/oomplt-mmdb" |
There was a problem hiding this comment.
These constants could be private.
| return Success(null) | ||
| } else { | ||
| val url = buildGeoIpDbUrl(latestVersion) | ||
| val target = "$cacheDir/$latestVersion.mmdb" |
There was a problem hiding this comment.
Is the cacheDir the place we really want for these files? Is some systems, cache directories can be deleted periodically.
b1d98df to
305a640
Compare
| val currentTimeMillis = Clock.System.now().toEpochMilliseconds() | ||
| val oneDayInMillis = 24 * 60 * 60 * 1000L | ||
| val timeSinceLastCheck = currentTimeMillis - lastCheckMillis | ||
|
|
||
| if (timeSinceLastCheck < oneDayInMillis) { |
There was a problem hiding this comment.
You can take advantage of kotlin.time.Duration to make this more clear:
if (Clock.System.now() - Instant.fromEpochMilliseconds(lastCheckMillis) < 1.days) {
}
f0d6556 to
4ccfdd8
Compare
Closes ooni/probe#2868