Skip to content
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

Fix compiler warnings related to Crystal 1.14 #232

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions manual/model/transactions-and-save-points/connection-pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ begin
# Clear automatically create a connection nº1
Clear::SQL.transaction do
Clear::SQL.insert("tests", {id: 1}).execute
sleep 0.2 #< Wait and do not commit the transaction for now
sleep 0.2.seconds # Wait and do not commit the transaction for now
end
end

@@count = -1

# Spawn a new fiber
spawn do
sleep 0.1 #Wait a bit, to ensure than the first connection is inside a transaction
sleep 0.1.seconds # Wait a bit, to ensure than the first connection is inside a transaction
# execute in connection nº2
@@count = Clear::SQL.select.from("tests").count
end

sleep 0.3 # Let the 2 fiber time to finish...
sleep 0.3.seconds # Let the 2 fiber time to finish...

# The count is zero, because: it has been setup by the second fiber, which
# called AFTER the insert but BEFORE the commit on the connection nº1
Expand Down
6 changes: 3 additions & 3 deletions spec/sql/connection_pool_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ module ConnectionPoolSpec
spawn do
Clear::SQL.transaction do
Clear::SQL.insert("tests", {id: 1}).execute
sleep 0.2 # < The transaction is not yet commited
sleep 0.2.seconds # < The transaction is not yet commited
end
end

@@count = 0

spawn do
# Not inside the transaction so count must be zero since the transaction is not finished:
sleep 0.1
sleep 0.1.seconds
@@count = Clear::SQL.select.from("tests").count
end

sleep 0.3 # Let the 2 spawn finish...
sleep 0.3.seconds # Let the 2 spawn finish...

@@count.should eq 0 # < If one, the connection pool got wrong with the fiber.

Expand Down
2 changes: 1 addition & 1 deletion spec/sql/select/lock_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module LockSpec
Clear::SQL.select.from(:to_lock).pluck_col(:id).should eq [1]
end

sleep(0.05) # Give hand to the other fiber. Now it should be not locked anymore?
sleep 0.05.seconds # Give hand to the other fiber. Now it should be not locked anymore?
Clear::SQL.select.from(:to_lock).order_by("id", :asc).pluck_col(:id).should eq [1, 2]
ensure
Clear::SQL.execute("DROP TABLE to_lock")
Expand Down
2 changes: 1 addition & 1 deletion src/clear/expression/expression.cr
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Clear::Expression
@value
end

def to_json(b = nil)
def to_json(x = nil)
@value
end
end
Expand Down