Skip to content

WIP: Session execute_read/write implementation #251

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
wants to merge 8 commits into
base: 5.0
Choose a base branch
from

Conversation

JuliaKovtun
Copy link

No description provided.

@JuliaKovtun JuliaKovtun force-pushed the impl-execute-read-write branch from 6a47c16 to db04fb7 Compare May 14, 2025 15:18
Copy link
Member

@klobuczek klobuczek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our spec write transaction function retries deadlocks corresponds to java test writeTransactionFunctionShouldRetryDeadlocks. That test is marked as deprecated. I don't see any tests testing the same functionality with executeWrite in java so we should not either. Let's exclude this test.
Furthermore, I think it would make sense to disable the deprecation message in test environment for readability.

Comment on lines 25 to 30
check do
super(
->(tx) { Struct::Wrapper.new(reverse_check { block.call(tx) }) },
to_java_config(Neo4j::Driver::TransactionConfig, **config)
).object
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would extract this to a separate private method. So the above logic can be simplified.

%i[read write].each do |mode|
["#{mode}_transaction", "execute_#{mode}"].each do |method_name|
define_method(method_name) do |**config, &block|
if method_name.include? 'transaction'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of backwards and sort of duplication.
I think in this case it would be better to have 2 separate method definitions. One with deprecation and another without.

super(
->(tx) { Struct::Wrapper.new(reverse_check { block.call(tx) }) },
to_java_config(Neo4j::Driver::TransactionConfig, **config)
).object
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's increase our max line length to 160. That's what we have on all our projects.


check do
super(
->(tx) { Struct::Wrapper.new(reverse_check { block.call(tx) }) },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check if Struct::Wrapper is still required.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, will check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants