-
Notifications
You must be signed in to change notification settings - Fork 203
Implement progress handler interface #458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fractaledmind
wants to merge
23
commits into
sparklemotion:main
Choose a base branch
from
fractaledmind:progress-handler
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6c4e155
Add the progress_handler interface
fractaledmind 046bd67
Add tests for the progress_handler interface
fractaledmind 11a94dc
Merge branch 'main' into progress-handler
fractaledmind 50f1ef0
Remove extra line
fractaledmind c6bf834
Bump the frequency for the opcode arg test
fractaledmind 3681b2a
Bump the frequency for the opcode arg test and make assertion more re…
fractaledmind c0d5144
Only define the ruby progress_handler method if the OMIT compilation …
fractaledmind 02e6f0a
Properly protect the progress_handler depending on whether or not the…
fractaledmind da216c9
Skip progress_handler tests if the method is not defined
fractaledmind 35a003a
WIP: make progress_handler GC-compaction safe
fractaledmind af1da42
Improve the compaction-safe version of the progress_handler
fractaledmind ce03826
Remove allocation bit
fractaledmind 2aa7eae
Merge remote-tracking branch 'upstream/main' into progress-handler
fractaledmind 22679e4
Merge branch 'main' into progress-handler
fractaledmind 824627d
Merge branch 'main' into progress-handler
fractaledmind 535d184
Default to progress handler every 1000 VM instructions
fractaledmind e12ef7d
Merge branch 'main' into progress-handler
fractaledmind 4eb2870
Fix conditional check for defining progress_handler method
fractaledmind e7debf0
Add test showing how progress_handler can be used to increase concurr…
fractaledmind 0fdd551
Fix Standard issue
fractaledmind dcd3b08
Fix tests now that the default number of vm steps for the progress_ha…
fractaledmind e5a18b9
Loosen test assertion for progress_handler releasing GVL
fractaledmind 361a7e2
Loosen test assertion for progress_handler releasing GVL even more
fractaledmind File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -470,7 +470,7 @@ def test_transaction_active | |
|
||
def test_transaction_implicit_rollback | ||
assert [email protected]_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(10, 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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.