Skip to content

Commit

Permalink
Merge pull request #2 from place-labs/fix/connection_lost
Browse files Browse the repository at this point in the history
fix(statement.cr): close connection before raising DB::ConnectionLost
  • Loading branch information
dukenguyenxyz authored Sep 3, 2021
2 parents cafe572 + 838f871 commit 4b4fa3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 0.24.0

dependencies:
db:
github: crystal-lang/crystal-db
version: ~> 0.10.0
github: place-labs/crystal-db
branch: master

crystal: ">= 0.35.0, < 2.0.0"
2 changes: 2 additions & 0 deletions src/pg/statement.cr
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class PG::Statement < ::DB::Statement
end
ResultSet.new(self, fields)
rescue IO::Error
connection.close
raise DB::ConnectionLost.new(connection)
end

Expand All @@ -39,6 +40,7 @@ class PG::Statement < ::DB::Statement
last_insert_id: 0_i64 # postgres doesn't support this
)
rescue IO::Error
connection.close
raise DB::ConnectionLost.new(connection)
end
end

0 comments on commit 4b4fa3d

Please sign in to comment.