Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache time zone from lat/lon results #6

Merged
merged 1 commit into from
Feb 13, 2024
Merged

Conversation

pnbruckner
Copy link
Owner

Determining time zone from lat & lon can take a significant amount of time. Since time zone will not change for same lat/lon values, add a cache of calculated values. To maximize cache hits, round lat & lon to 4 digits each (which is equivalent to about 11 meters, similar to what is done for Nominatim location caching.)

Also, in update_zones, ignore events without data. For some reason, at startup, there are two core_config_updated events fired (with no data), even though the core config has not actually changed. Ignoring these eliminates unnecessary time zone lookups for HA zones.

For time zone lookup, round lat/lon to 4 digits.

Ignore core_config_updated events without data.
@pnbruckner pnbruckner merged commit da907ae into main Feb 13, 2024
4 checks passed
@pnbruckner pnbruckner deleted the cache-tz-lookups branch February 13, 2024 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant