Skip to content

Commit

Permalink
Merge pull request #582 from sparklemotion/flavorjones-doc-20241119
Browse files Browse the repository at this point in the history
update fork_safety doc strings and changelog
  • Loading branch information
flavorjones authored Nov 19, 2024
2 parents 48eb4fc + bd50e98 commit c0f6df8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added

- `Database#optimize` which wraps the `pragma optimize;` statement. Also added `Constants::Optimize` to allow advanced users to pass a bitmask of options. See https://www.sqlite.org/pragma.html#pragma_optimize. [#572] @alexcwatt @flavorjones
- `SQLite3::VERSION_INFO` is a new constant that tracks a bag of metadata about the gem and the sqlite library used. `SQLite3::SQLITE_PACKAGED_LIBRARIES` and `SQLite3::SQLITE_PRECOMPILED_LIBRARIES` are new constants indicating how the gem was built. [#581] @flavorjones


### Fixed
Expand Down
10 changes: 5 additions & 5 deletions lib/sqlite3/fork_safety.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

require "weakref"

# based on Rails's active_support/fork_tracker.rb
module SQLite3
# based on Rails's active_support/fork_tracker.rb
module ForkSafety
module CoreExt
module CoreExt # :nodoc:
def _fork
pid = super
if pid == 0
Expand All @@ -20,17 +20,17 @@ def _fork
@suppress = false

class << self
def hook!
def hook! # :nodoc:
::Process.singleton_class.prepend(CoreExt)
end

def track(database)
def track(database) # :nodoc:
@mutex.synchronize do
@databases << WeakRef.new(database)
end
end

def discard
def discard # :nodoc:
warned = @suppress
@databases.each do |db|
next unless db.weakref_alive?
Expand Down

0 comments on commit c0f6df8

Please sign in to comment.