File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -35,17 +35,21 @@ def discard # :nodoc:
35
35
@databases . each do |db |
36
36
next unless db . weakref_alive?
37
37
38
- unless db . closed? || db . readonly?
39
- unless warned
40
- # If you are here, you may want to read
41
- # https://github.com/sparklemotion/sqlite3-ruby/pull/558
42
- warn ( "Writable sqlite database connection(s) were inherited from a forked process. " \
43
- "This is unsafe and the connections are being closed to prevent possible data " \
44
- "corruption. Please close writable sqlite database connections before forking." ,
45
- uplevel : 0 )
46
- warned = true
38
+ begin
39
+ unless db . closed? || db . readonly?
40
+ unless warned
41
+ # If you are here, you may want to read
42
+ # https://github.com/sparklemotion/sqlite3-ruby/pull/558
43
+ warn ( "Writable sqlite database connection(s) were inherited from a forked process. " \
44
+ "This is unsafe and the connections are being closed to prevent possible data " \
45
+ "corruption. Please close writable sqlite database connections before forking." ,
46
+ uplevel : 0 )
47
+ warned = true
48
+ end
49
+ db . close
47
50
end
48
- db . close
51
+ rescue WeakRef ::RefError
52
+ # GC may run while this method is executing, and that's OK
49
53
end
50
54
end
51
55
@databases . clear
You can’t perform that action at this time.
0 commit comments