diff --git a/.app_version b/.app_version index 61e6e92d..b72b05ed 100644 --- a/.app_version +++ b/.app_version @@ -1 +1 @@ -0.19.2 +0.19.3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 88b0a520..b67dd939 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +# 0.19.3 - 2024-12-06 + +### Changed + +- Refactored stats calculation to calculate only necessary stats, instead of calculating all stats +- Stats are now being calculated every 1 hour instead of 6 hours +- List of years on the Map page is now being calculated based on user's points instead of stats. It's also being cached for 1 day due to the fact that it's usually a heavy operation based on the number of points. +- Reverse-geocoding points is now being performed in batches of 1,000 points to prevent memory exhaustion. + # 0.19.2 - 2024-12-04 ## The Telemetry release diff --git a/app/jobs/cache/preheating_job.rb b/app/jobs/cache/preheating_job.rb index 75353ed8..bdf3ea99 100644 --- a/app/jobs/cache/preheating_job.rb +++ b/app/jobs/cache/preheating_job.rb @@ -5,9 +5,7 @@ class Cache::PreheatingJob < ApplicationJob def perform User.find_each do |user| - Rails.cache.fetch("dawarich/user_#{user.id}_years_tracked", expires_in: 1.day) do - user.years_tracked - end + Rails.cache.write("dawarich/user_#{user.id}_years_tracked", user.years_tracked, expires_in: 1.day) end end end diff --git a/app/models/stat.rb b/app/models/stat.rb index 8bfe5b36..9376c991 100644 --- a/app/models/stat.rb +++ b/app/models/stat.rb @@ -35,12 +35,6 @@ class Stat < ApplicationRecord } end - def self.years - starting_year = select(:year).min&.year || Time.current.year - - (starting_year..Time.current.year).to_a.reverse - end - def points user.tracked_points .without_raw_data diff --git a/app/services/jobs/create.rb b/app/services/jobs/create.rb index fdefe62d..ff8466be 100644 --- a/app/services/jobs/create.rb +++ b/app/services/jobs/create.rb @@ -21,6 +21,6 @@ class Jobs::Create raise InvalidJobName, 'Invalid job name' end - points.each(&:async_reverse_geocode) + points.find_each(batch_size: 1_000, &:async_reverse_geocode) end end diff --git a/app/views/shared/_right_sidebar.html.erb b/app/views/shared/_right_sidebar.html.erb index 87c99c04..797adaeb 100644 --- a/app/views/shared/_right_sidebar.html.erb +++ b/app/views/shared/_right_sidebar.html.erb @@ -4,7 +4,7 @@