Skip to content

Commit c293585

Browse files
committed
Run GC explicitly as workaround
1 parent 44723e6 commit c293585

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

.github/workflows/test.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,11 @@ jobs:
6767
sudo systemctl restart postgresql
6868
sudo -u postgres -H psql -c "CREATE ROLE ${USER} SUPERUSER LOGIN;"
6969
- name: "Test: SQLite3"
70-
env:
71-
# We can remove this once ADBC 20 is released.
72-
ACTIVERECORD_ADBC_ADAPTER_GC: disable
7370
run: |
7471
bundle exec rake
7572
- name: "Test: PostgreSQL"
7673
env:
7774
ACTIVERECORD_ADBC_ADAPTER_BACKEND: postgresql
78-
# We can remove this once ADBC 20 is released.
79-
ACTIVERECORD_ADBC_ADAPTER_GC: disable
8075
PGHOST: /var/run/postgresql
8176
run: |
8277
bundle exec rake

lib/activerecord_adbc_adapter/database_statements.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,19 @@ def perform_query(raw_connection,
3333
raw_records[bind.name] = array
3434
end
3535
record_batch = Arrow::RecordBatch.new(raw_records)
36-
statement.bind(record_batch) do
37-
statement.execute[0]
36+
if defined?(::ADBCArrow)
37+
# We can remove this once ADBC 20 is released.
38+
begin
39+
statement.bind(record_batch) do
40+
statement.execute[0]
41+
end
42+
ensure
43+
GC.start
44+
end
45+
else
46+
statement.bind(record_batch) do
47+
statement.execute[0]
48+
end
3849
end
3950
end
4051
end

test/helper.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55

66
require_relative "helper/user"
77

8-
if ENV["ACTIVERECORD_ADBC_ADAPTER_GC"] == "disable"
9-
GC.disable
10-
end
11-
128
if ENV["ACTIVERECORD_ADBC_ADAPTER_DEBUG"] == "yes"
139
ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDERR)
1410
end

0 commit comments

Comments
 (0)