From 6c4e1553ef80c0369b7b14be25de12212f95be68 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Sun, 7 Jan 2024 18:57:15 +0100 Subject: [PATCH 01/18] Add the progress_handler interface --- ext/sqlite3/database.c | 46 +++++++++++++++++++++++++++++++++++++++++ lib/sqlite3/database.rb | 1 + 2 files changed, 47 insertions(+) diff --git a/ext/sqlite3/database.c b/ext/sqlite3/database.c index bd7b2ea6..15b318c4 100644 --- a/ext/sqlite3/database.c +++ b/ext/sqlite3/database.c @@ -237,6 +237,51 @@ static VALUE busy_handler(int argc, VALUE *argv, VALUE self) return self; } +static int +rb_sqlite3_progress_handler(void *ctx) +{ + VALUE self = (VALUE)(ctx); + VALUE handle = rb_iv_get(self, "@progress_handler"); + VALUE result = rb_funcall(handle, rb_intern("call"), 0); + + if (Qfalse == result) return 1; + + return 0; +} + +/* call-seq: + * progress_handler([n]) { ... } + * progress_handler([n,] Class.new { def call; end }.new) + * + * Register a progress handler with this database instance. + * This handler will be invoked periodically during a long-running query or operation. + * If the handler returns +false+, the operation will be interrupted; otherwise, it continues. + * The parameter 'n' specifies the number of SQLite virtual machine instructions between invocations. + * If 'n' is not provided, the default value is 1. + */ +static VALUE +progress_handler(int argc, VALUE *argv, VALUE self) +{ + sqlite3RubyPtr ctx; + VALUE block, n_value; + + TypedData_Get_Struct(self, sqlite3Ruby, &database_type, ctx); + REQUIRE_OPEN_DB(ctx); + + rb_scan_args(argc, argv, "02", &n_value, &block); + + int n = NIL_P(n_value) ? 1 : NUM2INT(n_value); + if(NIL_P(block) && rb_block_given_p()) block = rb_block_proc(); + + rb_iv_set(self, "@progress_handler", block); + + sqlite3_progress_handler( + ctx->db, n, NIL_P(block) ? NULL : rb_sqlite3_progress_handler, (void *)self); + + return self; +} + + /* call-seq: last_insert_row_id * * Obtains the unique row ID of the last row to be inserted by this Database @@ -854,6 +899,7 @@ void init_sqlite3_database(void) rb_define_method(cSqlite3Database, "changes", changes, 0); rb_define_method(cSqlite3Database, "authorizer=", set_authorizer, 1); rb_define_method(cSqlite3Database, "busy_handler", busy_handler, -1); + rb_define_method(cSqlite3Database, "progress_handler", progress_handler, -1); rb_define_method(cSqlite3Database, "busy_timeout=", set_busy_timeout, 1); rb_define_method(cSqlite3Database, "extended_result_codes=", set_extended_result_codes, 1); rb_define_method(cSqlite3Database, "transaction_active?", transaction_active_p, 0); diff --git a/lib/sqlite3/database.rb b/lib/sqlite3/database.rb index 5d004a23..7cad9403 100644 --- a/lib/sqlite3/database.rb +++ b/lib/sqlite3/database.rb @@ -124,6 +124,7 @@ def initialize file, options = {}, zvfs = nil @authorizer = nil @encoding = nil @busy_handler = nil + @progress_handler = nil @collations = {} @functions = {} @results_as_hash = options[:results_as_hash] From 046bd67a574399b2b05a4f5c32181d7a0af73437 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Sun, 7 Jan 2024 18:57:26 +0100 Subject: [PATCH 02/18] Add tests for the progress_handler interface --- test/test_integration.rb | 54 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/test/test_integration.rb b/test/test_integration.rb index d5ea3a53..a7b94a4e 100644 --- a/test/test_integration.rb +++ b/test/test_integration.rb @@ -470,7 +470,7 @@ def test_transaction_active def test_transaction_implicit_rollback assert !@db.transaction_active? - @db.transaction + @db.transaction @db.execute('create table bar (x CHECK(1 = 0))') assert @db.transaction_active? assert_raises( SQLite3::ConstraintException ) do @@ -504,4 +504,56 @@ def test_bind_array_parameter [ 1, "foo" ] ) assert_equal "foo", result end + + def test_progress_handler_used + progress_calls = [] + @db.progress_handler do + progress_calls << nil + true + end + @db.execute "create table test1(a, b)" + + assert_operator 1, :<, progress_calls.size + end + + def test_progress_handler_opcode_arg + progress_calls = [] + handler = Proc.new do + progress_calls << nil + true + end + @db.progress_handler(1, handler) + @db.execute "create table test1(a, b)" + first_count = progress_calls.size + + progress_calls = [] + @db.progress_handler(2, handler) + @db.execute "create table test2(a, b)" + second_count = progress_calls.size + + assert_operator first_count, :>, second_count + end + + def test_progress_handler_interrupts_operation + @db.progress_handler do + false + end + + assert_raises(SQLite3::InterruptException) do + @db.execute "create table test1(a, b)" + end + end + + def test_clear_handler + progress_calls = [] + @db.progress_handler do + progress_calls << nil + true + end + @db.progress_handler(nil) + + @db.execute "create table test1(a, b)" + + assert_equal 0, progress_calls.size + end end From 50f1ef011d8f7cfbc96c5e6078109a0a231560c8 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Sun, 7 Jan 2024 21:02:15 +0100 Subject: [PATCH 03/18] Remove extra line --- ext/sqlite3/database.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ext/sqlite3/database.c b/ext/sqlite3/database.c index 3a0c6a39..139d7f3d 100644 --- a/ext/sqlite3/database.c +++ b/ext/sqlite3/database.c @@ -887,7 +887,6 @@ init_sqlite3_database(void) #if 0 VALUE mSqlite3 = rb_define_module("SQLite3"); #endif - cSqlite3Database = rb_define_class_under(mSqlite3, "Database", rb_cObject); rb_define_alloc_func(cSqlite3Database, allocate); From c6bf834b052e0f05249acfe9807fc2c802b6191f Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Sun, 7 Jan 2024 21:16:25 +0100 Subject: [PATCH 04/18] Bump the frequency for the opcode arg test --- test/test_integration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_integration.rb b/test/test_integration.rb index a7b94a4e..dbe5e175 100644 --- a/test/test_integration.rb +++ b/test/test_integration.rb @@ -527,7 +527,7 @@ def test_progress_handler_opcode_arg first_count = progress_calls.size progress_calls = [] - @db.progress_handler(2, handler) + @db.progress_handler(4, handler) @db.execute "create table test2(a, b)" second_count = progress_calls.size From 3681b2a792faf3843256ba05798e887f852949b5 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Sun, 7 Jan 2024 21:18:47 +0100 Subject: [PATCH 05/18] Bump the frequency for the opcode arg test and make assertion more resilient --- test/test_integration.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_integration.rb b/test/test_integration.rb index dbe5e175..29bd9ee3 100644 --- a/test/test_integration.rb +++ b/test/test_integration.rb @@ -527,11 +527,11 @@ def test_progress_handler_opcode_arg first_count = progress_calls.size progress_calls = [] - @db.progress_handler(4, handler) + @db.progress_handler(10, handler) @db.execute "create table test2(a, b)" second_count = progress_calls.size - assert_operator first_count, :>, second_count + assert_operator first_count, :>=, second_count end def test_progress_handler_interrupts_operation From c0d51448ae14799bdaf3d81e599f2ea46fcafe7c Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Sun, 7 Jan 2024 22:00:23 +0100 Subject: [PATCH 06/18] Only define the ruby progress_handler method if the OMIT compilation flag is not set --- ext/sqlite3/database.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/sqlite3/database.c b/ext/sqlite3/database.c index 139d7f3d..921d0ec3 100644 --- a/ext/sqlite3/database.c +++ b/ext/sqlite3/database.c @@ -911,7 +911,9 @@ init_sqlite3_database(void) rb_define_method(cSqlite3Database, "changes", changes, 0); rb_define_method(cSqlite3Database, "authorizer=", set_authorizer, 1); rb_define_method(cSqlite3Database, "busy_handler", busy_handler, -1); +#ifndef SQLITE_OMIT_PROGRESS_CALLBACK rb_define_method(cSqlite3Database, "progress_handler", progress_handler, -1); +#endif rb_define_method(cSqlite3Database, "busy_timeout=", set_busy_timeout, 1); rb_define_method(cSqlite3Database, "extended_result_codes=", set_extended_result_codes, 1); rb_define_method(cSqlite3Database, "transaction_active?", transaction_active_p, 0); From 02e6f0ae4d3b5d6f4075a741d1ea21bfa2c479c9 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Tue, 9 Jan 2024 09:40:52 +0100 Subject: [PATCH 07/18] Properly protect the progress_handler depending on whether or not the sqlite3_progress_handler function is present in the SQLite library --- ext/sqlite3/database.c | 4 +++- ext/sqlite3/extconf.rb | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/sqlite3/database.c b/ext/sqlite3/database.c index 921d0ec3..c24ff530 100644 --- a/ext/sqlite3/database.c +++ b/ext/sqlite3/database.c @@ -251,6 +251,7 @@ busy_handler(int argc, VALUE *argv, VALUE self) return self; } +#ifdef HAVE_SQLITE3_PROGRESS_HANDLER static int rb_sqlite3_progress_handler(void *ctx) { @@ -294,6 +295,7 @@ progress_handler(int argc, VALUE *argv, VALUE self) return self; } +#endif /* call-seq: last_insert_row_id @@ -911,7 +913,7 @@ init_sqlite3_database(void) rb_define_method(cSqlite3Database, "changes", changes, 0); rb_define_method(cSqlite3Database, "authorizer=", set_authorizer, 1); rb_define_method(cSqlite3Database, "busy_handler", busy_handler, -1); -#ifndef SQLITE_OMIT_PROGRESS_CALLBACK +#ifndef HAVE_SQLITE3_PROGRESS_HANDLER rb_define_method(cSqlite3Database, "progress_handler", progress_handler, -1); #endif rb_define_method(cSqlite3Database, "busy_timeout=", set_busy_timeout, 1); diff --git a/ext/sqlite3/extconf.rb b/ext/sqlite3/extconf.rb index d48e84a2..5c70259a 100644 --- a/ext/sqlite3/extconf.rb +++ b/ext/sqlite3/extconf.rb @@ -121,6 +121,7 @@ def configure_extension have_func('sqlite3_column_database_name') have_func('sqlite3_enable_load_extension') have_func('sqlite3_load_extension') + have_func('sqlite3_progress_handler') unless have_func('sqlite3_open_v2') # https://www.sqlite.org/releaselog/3_5_0.html abort("\nPlease use a version of SQLite3 >= 3.5.0\n\n") From da216c9266b8c47f8f2cdfa3fc490350c3e58132 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Tue, 9 Jan 2024 09:44:11 +0100 Subject: [PATCH 08/18] Skip progress_handler tests if the method is not defined --- test/test_integration.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test_integration.rb b/test/test_integration.rb index 29bd9ee3..4bec44c9 100644 --- a/test/test_integration.rb +++ b/test/test_integration.rb @@ -505,7 +505,11 @@ def test_bind_array_parameter assert_equal "foo", result end + ### + # The `progress_handler` method may not exist depending on how sqlite3 was compiled def test_progress_handler_used + skip("progress_handler method not defined") unless @db.respond_to?(:progress_handler) + progress_calls = [] @db.progress_handler do progress_calls << nil @@ -517,6 +521,8 @@ def test_progress_handler_used end def test_progress_handler_opcode_arg + skip("progress_handler method not defined") unless @db.respond_to?(:progress_handler) + progress_calls = [] handler = Proc.new do progress_calls << nil @@ -535,6 +541,8 @@ def test_progress_handler_opcode_arg end def test_progress_handler_interrupts_operation + skip("progress_handler method not defined") unless @db.respond_to?(:progress_handler) + @db.progress_handler do false end @@ -545,6 +553,8 @@ def test_progress_handler_interrupts_operation end def test_clear_handler + skip("progress_handler method not defined") unless @db.respond_to?(:progress_handler) + progress_calls = [] @db.progress_handler do progress_calls << nil From 35a003a49815b96ab3ba1b4fa4b5a0650a053f14 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Tue, 9 Jan 2024 11:52:38 +0100 Subject: [PATCH 09/18] WIP: make progress_handler GC-compaction safe --- ext/sqlite3/database.c | 8 +++++--- ext/sqlite3/database.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ext/sqlite3/database.c b/ext/sqlite3/database.c index c24ff530..2b2cda8d 100644 --- a/ext/sqlite3/database.c +++ b/ext/sqlite3/database.c @@ -46,6 +46,9 @@ static VALUE allocate(VALUE klass) { sqlite3RubyPtr ctx; + ctx->progress_handler = Qnil; + + return TypedData_Make_Struct(klass, sqlite3Ruby, &database_type, ctx); } @@ -256,8 +259,7 @@ static int rb_sqlite3_progress_handler(void *ctx) { VALUE self = (VALUE)(ctx); - VALUE handle = rb_iv_get(self, "@progress_handler"); - VALUE result = rb_funcall(handle, rb_intern("call"), 0); + VALUE result = rb_funcall(ctx->progress_handler, rb_intern("call"), 0); if (Qfalse == result) return 1; @@ -288,7 +290,7 @@ progress_handler(int argc, VALUE *argv, VALUE self) int n = NIL_P(n_value) ? 1 : NUM2INT(n_value); if(NIL_P(block) && rb_block_given_p()) block = rb_block_proc(); - rb_iv_set(self, "@progress_handler", block); + ctx->progress_handler = block; sqlite3_progress_handler( ctx->db, n, NIL_P(block) ? NULL : rb_sqlite3_progress_handler, (void *)self); diff --git a/ext/sqlite3/database.h b/ext/sqlite3/database.h index ad3527a2..4418d806 100644 --- a/ext/sqlite3/database.h +++ b/ext/sqlite3/database.h @@ -5,6 +5,7 @@ struct _sqlite3Ruby { sqlite3 *db; + VALUE progress_handler; }; typedef struct _sqlite3Ruby sqlite3Ruby; From af1da42d90e836dd59a18cc25445600e1b303e19 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Tue, 9 Jan 2024 15:03:50 +0100 Subject: [PATCH 10/18] Improve the compaction-safe version of the progress_handler --- ext/sqlite3/database.c | 43 ++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/ext/sqlite3/database.c b/ext/sqlite3/database.c index 2b2cda8d..764d41ae 100644 --- a/ext/sqlite3/database.c +++ b/ext/sqlite3/database.c @@ -12,6 +12,13 @@ VALUE cSqlite3Database; +static void +database_mark(void *ctx) +{ + sqlite3RubyPtr c = (sqlite3RubyPtr)ctx; + rb_gc_mark_movable(c->progress_handler); +} + static void deallocate(void *ctx) { @@ -30,16 +37,22 @@ database_memsize(const void *ctx) return sizeof(*c); } +static void +database_update_references(void *ctx) +{ + sqlite3RubyPtr c = (sqlite3RubyPtr)ctx; + c->progress_handler = rb_gc_location(c->progress_handler); +} + static const rb_data_type_t database_type = { - "SQLite3::Backup", - { - NULL, - deallocate, - database_memsize, + .wrap_struct_name = "SQLite3::Backup", + .function = { + .dmark = database_mark, + .dfree = deallocate, + .dsize = database_memsize, + .dcompact = database_update_references, }, - 0, - 0, - RUBY_TYPED_WB_PROTECTED, // Not freed immediately because the dfree function do IOs. + .flags = RUBY_TYPED_WB_PROTECTED, // Not freed immediately because the dfree function do IOs. }; static VALUE @@ -256,10 +269,12 @@ busy_handler(int argc, VALUE *argv, VALUE self) #ifdef HAVE_SQLITE3_PROGRESS_HANDLER static int -rb_sqlite3_progress_handler(void *ctx) +rb_sqlite3_progress_handler(void *context) { - VALUE self = (VALUE)(ctx); - VALUE result = rb_funcall(ctx->progress_handler, rb_intern("call"), 0); + sqlite3RubyPtr ctx = (sqlite3RubyPtr)context; + + VALUE handle = ctx->progress_handler; + VALUE result = rb_funcall(handle, rb_intern("call"), 0); if (Qfalse == result) return 1; @@ -293,7 +308,11 @@ progress_handler(int argc, VALUE *argv, VALUE self) ctx->progress_handler = block; sqlite3_progress_handler( - ctx->db, n, NIL_P(block) ? NULL : rb_sqlite3_progress_handler, (void *)self); + ctx->db, + n, + NIL_P(block) ? NULL : rb_sqlite3_progress_handler, + (void *)ctx + ); return self; } From ce038266930969636e67415670fb9ecca1df48a4 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Tue, 9 Jan 2024 16:02:06 +0100 Subject: [PATCH 11/18] Remove allocation bit --- ext/sqlite3/database.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ext/sqlite3/database.c b/ext/sqlite3/database.c index 764d41ae..83fbec19 100644 --- a/ext/sqlite3/database.c +++ b/ext/sqlite3/database.c @@ -59,8 +59,6 @@ static VALUE allocate(VALUE klass) { sqlite3RubyPtr ctx; - ctx->progress_handler = Qnil; - return TypedData_Make_Struct(klass, sqlite3Ruby, &database_type, ctx); } From 535d184a95db0041e62bb852fd69f2aee9262318 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Thu, 18 Jan 2024 11:21:33 +0100 Subject: [PATCH 12/18] Default to progress handler every 1000 VM instructions --- ext/sqlite3/database.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/sqlite3/database.c b/ext/sqlite3/database.c index 63a5cb39..978a5ca2 100644 --- a/ext/sqlite3/database.c +++ b/ext/sqlite3/database.c @@ -296,7 +296,7 @@ progress_handler(int argc, VALUE *argv, VALUE self) rb_scan_args(argc, argv, "02", &n_value, &block); - int n = NIL_P(n_value) ? 1 : NUM2INT(n_value); + int n = NIL_P(n_value) ? 1000 : NUM2INT(n_value); if (NIL_P(block) && rb_block_given_p()) { block = rb_block_proc(); } ctx->progress_handler = block; From 4eb287096dd64ed204860dcac540aac0a1d64b26 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Fri, 26 Jan 2024 11:09:15 +0100 Subject: [PATCH 13/18] Fix conditional check for defining progress_handler method --- ext/sqlite3/database.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/sqlite3/database.c b/ext/sqlite3/database.c index 978a5ca2..2d12693a 100644 --- a/ext/sqlite3/database.c +++ b/ext/sqlite3/database.c @@ -941,7 +941,7 @@ init_sqlite3_database(void) rb_define_method(cSqlite3Database, "enable_load_extension", enable_load_extension, 1); #endif -#ifndef HAVE_SQLITE3_PROGRESS_HANDLER +#ifdef HAVE_SQLITE3_PROGRESS_HANDLER rb_define_method(cSqlite3Database, "progress_handler", progress_handler, -1); #endif From e7debf01a3c3dd6463f0c1c992584af63a37b555 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Fri, 26 Jan 2024 11:10:05 +0100 Subject: [PATCH 14/18] Add test showing how progress_handler can be used to increase concurrency --- test/test_integration_pending.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/test_integration_pending.rb b/test/test_integration_pending.rb index 1a25910b..171652fa 100644 --- a/test/test_integration_pending.rb +++ b/test/test_integration_pending.rb @@ -110,4 +110,31 @@ def test_busy_handler_timeout_releases_gvl assert_operator work.size - work.find_index("|"), :>, 3 end + + def test_progress_handler_releasing_gvl + work = [] + + Thread.new do + loop do + sleep 0.1 + work << "." + end + end + + @db.progress_handler { Thread.pass } + + work << ">" + @db.execute <<~SQL + WITH RECURSIVE r(i) AS ( + VALUES(0) + UNION ALL + SELECT i FROM r + LIMIT 10000000 + ) + SELECT i FROM r WHERE i = 1; + SQL + work << "<" + + assert_operator work.find_index("<") - work.find_index(">"), :>, 9 + end end From 0fdd551308ffccf26b1669e171fcec0f71b30ae3 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Fri, 26 Jan 2024 11:21:45 +0100 Subject: [PATCH 15/18] Fix Standard issue --- test/test_integration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_integration.rb b/test/test_integration.rb index 9b9b08f4..55189b68 100644 --- a/test/test_integration.rb +++ b/test/test_integration.rb @@ -525,7 +525,7 @@ def test_progress_handler_opcode_arg skip("progress_handler method not defined") unless @db.respond_to?(:progress_handler) progress_calls = [] - handler = Proc.new do + handler = proc do progress_calls << nil true end From dcd3b08d15918f572c8fcd514d5daeb45605fc55 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Fri, 26 Jan 2024 11:30:07 +0100 Subject: [PATCH 16/18] Fix tests now that the default number of vm steps for the progress_handler is 1000 --- test/test_integration.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_integration.rb b/test/test_integration.rb index 55189b68..609ecf48 100644 --- a/test/test_integration.rb +++ b/test/test_integration.rb @@ -512,7 +512,7 @@ def test_progress_handler_used skip("progress_handler method not defined") unless @db.respond_to?(:progress_handler) progress_calls = [] - @db.progress_handler do + @db.progress_handler(10) do progress_calls << nil true end @@ -544,7 +544,7 @@ def test_progress_handler_opcode_arg def test_progress_handler_interrupts_operation skip("progress_handler method not defined") unless @db.respond_to?(:progress_handler) - @db.progress_handler do + @db.progress_handler(10) do false end From e5a18b9ef43ebdf88a2f662527f5be14026e7f17 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Fri, 26 Jan 2024 11:34:58 +0100 Subject: [PATCH 17/18] Loosen test assertion for progress_handler releasing GVL --- test/test_integration_pending.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_integration_pending.rb b/test/test_integration_pending.rb index 171652fa..7dd0edee 100644 --- a/test/test_integration_pending.rb +++ b/test/test_integration_pending.rb @@ -135,6 +135,6 @@ def test_progress_handler_releasing_gvl SQL work << "<" - assert_operator work.find_index("<") - work.find_index(">"), :>, 9 + assert_operator work.find_index("<") - work.find_index(">"), :>, 5 end end From 361a7e288980ba02cc19a0e2460a3b1739689578 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Fri, 26 Jan 2024 11:49:24 +0100 Subject: [PATCH 18/18] Loosen test assertion for progress_handler releasing GVL even more --- test/test_integration_pending.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_integration_pending.rb b/test/test_integration_pending.rb index 7dd0edee..706f2adb 100644 --- a/test/test_integration_pending.rb +++ b/test/test_integration_pending.rb @@ -135,6 +135,6 @@ def test_progress_handler_releasing_gvl SQL work << "<" - assert_operator work.find_index("<") - work.find_index(">"), :>, 5 + assert_operator work.find_index("<") - work.find_index(">"), :>, 2 end end