This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "json" | |
| summary = { | |
| max_connections: ActiveRecord::Base.connection.select_value("SELECT current_setting('max_connections')::int"), | |
| total: ActiveRecord::Base.connection.select_value("SELECT count(*) FROM pg_stat_activity"), | |
| active: ActiveRecord::Base.connection.select_value("SELECT count(*) FROM pg_stat_activity WHERE state = 'active'"), | |
| idle: ActiveRecord::Base.connection.select_value("SELECT count(*) FROM pg_stat_activity WHERE state = 'idle'"), | |
| idle_in_tx: ActiveRecord::Base.connection.select_value("SELECT count(*) FROM pg_stat_activity WHERE state = 'idle in transaction'"), | |
| db_size: ActiveRecord::Base.connection.select_value("SELECT pg_size_pretty(pg_database_size(current_database()))"), | |
| shared_buffers: ActiveRecord::Base.connection.select_value("SELECT current_setting('shared_buffers')"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| puts "ready=#{SolidQueue::ReadyExecution.count}" | |
| puts "claimed=#{SolidQueue::ClaimedExecution.count}" | |
| puts "failed24=#{SolidQueue::FailedExecution.where(created_at: 24.hours.ago..Time.current).count}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uid = ARGV[0] || '7e4837ca-52e1-49f1-8d7d-2ae5289fa921' | |
| puts "uid=#{uid}" | |
| doors = Rails.cache.read(DoorsForTurfCuttingCache.doors_cache_key(uid)) | |
| gf = Rails.cache.read(DoorsForTurfCuttingCache.geofence_cache_key(uid)) | |
| puts "cache_doors=#{doors.nil? ? 'nil' : doors.size} cache_gf=#{gf.present?}" | |
| raise 'no cache' if doors.nil? || gf.nil? | |
| # Force Ruby filter by using a slightly different polygon (same-ish area) | |
| geom = Turf.geojson_to_geometry(gf) | |
| coords = gf.dig('geometry', 'coordinates') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uid = '7e4837ca-52e1-49f1-8d7d-2ae5289fa921' | |
| t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
| key = DoorsForTurfCuttingCache.doors_cache_key(uid) | |
| doors = Rails.cache.read(key) | |
| gf = Rails.cache.read(DoorsForTurfCuttingCache.geofence_cache_key(uid)) | |
| puts "cache_doors=#{doors.nil? ? 'nil' : doors.size} cache_gf=#{gf.present?}" | |
| t_list0 = Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
| list = CanvassingApi.universe_list | |
| t_list1 = Process.clock_gettime(Process::CLOCK_MONOTONIC) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uid = '7e4837ca-52e1-49f1-8d7d-2ae5289fa921' | |
| t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
| cached = DoorsForTurfCuttingCache.cached?(uid) | |
| doors = Rails.cache.read(DoorsForTurfCuttingCache.doors_cache_key(uid)) | |
| gf = Rails.cache.read(DoorsForTurfCuttingCache.geofence_cache_key(uid)) | |
| puts "cached=#{cached} cache_doors=#{doors.nil? ? 'nil' : doors.size} cache_gf=#{gf.present?}" | |
| list = CanvassingApi.universe_list | |
| t1 = Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
| universe = list.find { |r| r['universe_id'] == uid } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| turf = Turf.find(1644) | |
| date = Date.new(2026, 8, 24) | |
| turf.update_columns(synced_at: nil) | |
| SyncTurfDetailsJob.perform_now(turf, date) | |
| turf.reload | |
| doors = Door.within_polygon(turf.polygon).where(universe_id: turf.universe_id, date_of_canvass: date).count | |
| puts({doors: doors, num_knockable: turf.num_knockable, num_people: turf.num_people, synced_at: turf.synced_at}.inspect) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'json' | |
| universe_id = 'f65499b9-fca1-4939-b7e7-d3565df9306b' | |
| geofence = { | |
| 'geometry' => { | |
| 'coordinates' => [[[-75.85691297192255, 41.23787048754199], [-75.85062214680615, 41.233681048731114], [-75.84877893327443, 41.235768822961106]]], | |
| 'type' => 'Polygon' | |
| }, | |
| 'properties' => {}, | |
| 'type' => 'Feature' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'json' | |
| universe_id = 'f65499b9-fca1-4939-b7e7-d3565df9306b' | |
| geofence = { | |
| 'geometry' => { | |
| 'coordinates' => [[[-75.85691297192255, 41.23787048754199], [-75.85062214680615, 41.233681048731114], [-75.84877893327443, 41.235768822961106]]], | |
| 'type' => 'Polygon' | |
| }, | |
| 'properties' => {}, | |
| 'type' => 'Feature' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| universe_id = 'f65499b9-fca1-4939-b7e7-d3565df9306b' | |
| geofence_open = { | |
| 'geometry' => { | |
| 'coordinates' => [[[-75.85691297192255, 41.23787048754199], [-75.85062214680615, 41.233681048731114], [-75.84877893327443, 41.235768822961106]]], | |
| 'type' => 'Polygon' | |
| }, | |
| 'properties' => {}, | |
| 'type' => 'Feature' | |
| } | |
| ring = geofence_open['geometry']['coordinates'][0] |