From 1da95c287ef3a8732a362106cfa685595807545a Mon Sep 17 00:00:00 2001 From: Keith Morrison Date: Fri, 27 Dec 2024 11:27:05 -0800 Subject: [PATCH] thread safety --- lib/ziptz.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ziptz.rb b/lib/ziptz.rb index 8771d7a..f838771 100644 --- a/lib/ziptz.rb +++ b/lib/ziptz.rb @@ -3,11 +3,11 @@ class Ziptz def self.instance - @instance ||= new + Thread.current[:ziptz_instance] ||= new end def db - @db ||= begin + Thread.current[:ziptz_db] ||= begin db = SQLite3::Database.open(tz_data_path) db.results_as_hash = true db