From f7f18fe143e2956b00b937c73087b7cbc25627e7 Mon Sep 17 00:00:00 2001 From: Nikita Kononov Date: Mon, 28 Jul 2025 12:12:06 +0000 Subject: [PATCH 1/2] add mutex for bean loading --- lib/smart_ioc/bean_factory.rb | 1 - lib/smart_ioc/bean_file_loader.rb | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/smart_ioc/bean_factory.rb b/lib/smart_ioc/bean_factory.rb index 9944fe3..8a005b1 100644 --- a/lib/smart_ioc/bean_factory.rb +++ b/lib/smart_ioc/bean_factory.rb @@ -12,7 +12,6 @@ def initialize(bean_definitions_storage, extra_package_contexts) @singleton_scope = SmartIoC::Scopes::Singleton.new @prototype_scope = SmartIoC::Scopes::Prototype.new @thread_scope = SmartIoC::Scopes::Request.new - @semaphore = Mutex.new end def clear_scopes diff --git a/lib/smart_ioc/bean_file_loader.rb b/lib/smart_ioc/bean_file_loader.rb index c2df329..36b3b97 100644 --- a/lib/smart_ioc/bean_file_loader.rb +++ b/lib/smart_ioc/bean_file_loader.rb @@ -2,6 +2,7 @@ class SmartIoC::BeanFileLoader def initialize @loaded_locations = {} @load_proc = Proc.new { |location| load(location) } + @semaphore = Mutex.new end def set_load_proc(&block) @@ -17,7 +18,10 @@ def require_bean(bean_name) locations.each do |location| next if @loaded_locations.has_key?(location) @loaded_locations[location] = true - @load_proc.call(location) + + @semaphore.synchronize do + @load_proc.call(location) + end end nil From 261beb79fa4fb2f954c12898ad3c68431ba72f23 Mon Sep 17 00:00:00 2001 From: Nikita Kononov Date: Mon, 28 Jul 2025 12:33:45 +0000 Subject: [PATCH 2/2] bump version to 0.5.3 --- Gemfile.lock | 2 +- lib/smart_ioc/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b6da326..6947245 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - smart_ioc (0.5.2) + smart_ioc (0.5.3) GEM remote: https://rubygems.org/ diff --git a/lib/smart_ioc/version.rb b/lib/smart_ioc/version.rb index 0e7a521..19dc867 100644 --- a/lib/smart_ioc/version.rb +++ b/lib/smart_ioc/version.rb @@ -1,3 +1,3 @@ module SmartIoC - VERSION = "0.5.2" + VERSION = "0.5.3" end