Skip to content

Commit

Permalink
thread safety
Browse files Browse the repository at this point in the history
  • Loading branch information
infused committed Dec 27, 2024
1 parent 35c7e48 commit 1da95c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ziptz.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1da95c2

Please sign in to comment.