fibered_mysql2 0.2.0.pre.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c336888076880a85f5be10b2784991a2a27784e9a3858bf97f79fe782ac6417f
4
- data.tar.gz: 59b46276bb6fbc0f6ee2c609195e438cc440dc160b13b26b2d113d034fac004f
3
+ metadata.gz: b96c3d593486e68e9bcb79ba3ece18c5bde2a4847cf6007b3711595a72491147
4
+ data.tar.gz: 57d3a719e17231f2582694a1590e8e6d43567bb75797ddc17b2591fe9e285ab0
5
5
  SHA512:
6
- metadata.gz: 4df7a46c2f65f930c08fc5233e73d4fd8b13d4b899feffe04b40d45ea944e4e35c89eae567d77187fdc6fd416a25b6080bb0fd2de7b4a1d8dc10e054c508f692
7
- data.tar.gz: 38300d691395f2f0c89cc4304c9e9f44df21f6e7df479ca9369e34829faa6eb3a366a0b0c470e1121a3311e8704f3b536fbcdff22fc7a974ff1ef0944ba00e50
6
+ metadata.gz: 7ec023e83475110f906ae85d79ffbe369014cfe33d71797ba09c3c3666f9af25353cac11d5f6ec6e7f5484f911b4b2310bcb44ff37d0510fe15c2e8d3d65daa7
7
+ data.tar.gz: 461cccb73f19c36f9a019a04955c492ef572a63540b6f0a849f02c9c1c640d996ed02cbf43150b195168710333d08b17b0e584d934e8811e6de10c1ba84cd92f
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
5
  Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.2.0] - 2023-01-12
8
+ ### Added
9
+ - Added support for Rails 6+ by adding knowledge of lazy transactions to the adapter.
10
+
7
11
  ## [0.1.5] - 2022-03-25
8
12
  ### Changed
9
13
  - Upgraded Bundler to 2.2.29 and Ruby to 2.7.5. Removed support for Rails 4.
@@ -37,6 +41,7 @@ threaded, not fibered.
37
41
  - Added TravisCI unit test pipeline.
38
42
  - Added coverage reports via Coveralls.
39
43
 
44
+ [0.2.0]: https://github.com/Invoca/fibered_mysql2/compare/v0.1.5..v0.2.0
40
45
  [0.1.5]: https://github.com/Invoca/fibered_mysql2/compare/v0.1.4..v0.1.5
41
46
  [0.1.4]: https://github.com/Invoca/fibered_mysql2/compare/v0.1.3..v0.1.4
42
47
  [0.1.3]: https://github.com/Invoca/fibered_mysql2/compare/v0.1.2..v0.1.3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fibered_mysql2 (0.2.0.pre.1)
4
+ fibered_mysql2 (0.2.0)
5
5
  em-synchrony (~> 1.0)
6
6
  rails (>= 5.2, < 7)
7
7
 
@@ -75,14 +75,8 @@ module FiberedMysql2
75
75
  case ::Rails::VERSION::MAJOR
76
76
  when 4
77
77
  include FiberedMysql2Adapter_4_2
78
- when 5
78
+ when 5, 6
79
79
  include FiberedMysql2Adapter_5_2
80
- when 6
81
- include FiberedMysql2Adapter_5_2
82
-
83
- def supports_lazy_transactions?
84
- false
85
- end
86
80
  end
87
81
 
88
82
  def initialize(*args)
@@ -47,6 +47,53 @@ module EM::Synchrony
47
47
  transaction
48
48
  end
49
49
  end
50
+
51
+ # Overriding the ActiveRecord::TransactionManager#materialize_transactions method to use
52
+ # fiber safe the _current_stack instead of the @stack instance variable. when marterializing
53
+ # transactions.
54
+ def materialize_transactions
55
+ return if @materializing_transactions
56
+ return unless @has_unmaterialized_transactions
57
+
58
+ @connection.lock.synchronize do
59
+ begin
60
+ @materializing_transactions = true
61
+ _current_stack.each { |t| t.materialize! unless t.materialized? }
62
+ ensure
63
+ @materializing_transactions = false
64
+ end
65
+ @has_unmaterialized_transactions = false
66
+ end
67
+ end
68
+
69
+ # Overriding the ActiveRecord::TransactionManager#commit_transaction method to use
70
+ # fiber safe the _current_stack instead of the @stack instance variable. when marterializing
71
+ # transactions.
72
+ def commit_transaction
73
+ @connection.lock.synchronize do
74
+ transaction = _current_stack.last
75
+
76
+ begin
77
+ transaction.before_commit_records
78
+ ensure
79
+ _current_stack.pop
80
+ end
81
+
82
+ transaction.commit
83
+ transaction.commit_records
84
+ end
85
+ end
86
+
87
+ # Overriding the ActiveRecord::TransactionManager#rollback_transaction method to use
88
+ # fiber safe the _current_stack instead of the @stack instance variable. when marterializing
89
+ # transactions.
90
+ def rollback_transaction(transaction = nil)
91
+ @connection.lock.synchronize do
92
+ transaction ||= _current_stack.pop
93
+ transaction.rollback
94
+ transaction.rollback_records
95
+ end
96
+ end
50
97
  end
51
98
  end
52
99
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FiberedMysql2
4
- VERSION = "0.2.0.pre.1"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fibered_mysql2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca Development
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-10 00:00:00.000000000 Z
11
+ date: 2023-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: em-synchrony
@@ -89,9 +89,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - ">"
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
- version: 1.3.1
94
+ version: '0'
95
95
  requirements: []
96
96
  rubygems_version: 3.1.6
97
97
  signing_key: