factory_bot_instrumentation 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fad506387bc8c52339b3868ba4026a436bb3b4602747eabd30dcf3f41ecd855
4
- data.tar.gz: a6c8adffc73924cbea80296c721ed264ba9378bba8f7bee7a1ec296871f17b79
3
+ metadata.gz: 106c1aa5ca524b01dbff80a366493e8e921d2b65aba880d156da6481f6798d74
4
+ data.tar.gz: 538be239cc2016d21996c85d96730c8501dfca703f5d7a1d259dc198aa0da880
5
5
  SHA512:
6
- metadata.gz: 24790a2a645d22cc50edefb2ee19c3215cfd173ac88bf3bced467a1b71ec73a984ae28e88e57d09f6ff938266c38d89262dfec1596a55516b74449e6e6de0437
7
- data.tar.gz: 741ac435c5ed84bcc622ac327598be7b37e1b98757772ee189eb5f01446ae766ee8b443380dbc97767d240b6ba329416d988f6d8dd1e1a8420b7ea83345a598f
6
+ metadata.gz: 423b35d7c9c7e590a1b312206f5f05a93407fa1fe3f5dff3790ae0ba9d263f782e7a3e8cbd24ae48307e422dd4806e15284b378b71f35792384d0fbf1739e449
7
+ data.tar.gz: 6f2211b069039602f7e74bfa6a5d737acf2a651953ce81e6c758fed27625719f4128abb419dd5a66accfa5614c89e7663e65e9944bca09674e58f05244158b28
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 1.0.1
2
+
3
+ * Added a retry logic to the FactoryBot reloading on the POST/create endpoint
4
+ in order to handle parallel requests properly (#13)
5
+
1
6
  ### 1.0.0
2
7
 
3
8
  * Bundler >= 2.3 is from now on required as minimal version (#12)
@@ -37,8 +37,11 @@ module FactoryBot
37
37
  #
38
38
  # The result is the API v1 representation of the created entity.
39
39
  def create
40
- # Reload the factories to improve the test development experience
41
- FactoryBot.reload
40
+ # Reload the factories to improve the test development experience.
41
+ # In parallel request conditions this may lead to +Factory already
42
+ # registered+ errors as this call is not thread safe as it seems,
43
+ # so we retry it multiple times.
44
+ with_retries(max_tries: 15) { FactoryBot.reload }
42
45
  # Call the factory construction with the user given parameters
43
46
  entity = FactoryBot.create(*factory_params)
44
47
  # Render the resulting entity with the configured rendering block
@@ -35,6 +35,7 @@ Gem::Specification.new do |spec|
35
35
 
36
36
  spec.add_runtime_dependency 'factory_bot', '~> 6.2'
37
37
  spec.add_runtime_dependency 'rails', '>= 5.2'
38
+ spec.add_runtime_dependency 'retries', '>= 0.0.5'
38
39
 
39
40
  spec.add_development_dependency 'appraisal', '~> 2.4'
40
41
  spec.add_development_dependency 'bundler', '~> 2.3'
@@ -4,7 +4,7 @@ module FactoryBot
4
4
  # The gem version details.
5
5
  module Instrumentation
6
6
  # The version of the +factory_bot_instrumentation+ gem
7
- VERSION = '1.0.0'
7
+ VERSION = '1.0.1'
8
8
 
9
9
  class << self
10
10
  # Returns the version of gem as a string.
@@ -7,6 +7,7 @@ require 'active_support/cache'
7
7
  require 'active_support/core_ext/hash'
8
8
  require 'active_support/time'
9
9
  require 'active_support/time_with_zone'
10
+ require 'retries'
10
11
 
11
12
  require 'factory_bot'
12
13
  require 'factory_bot/instrumentation/configuration'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_bot_instrumentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hermann Mayer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-18 00:00:00.000000000 Z
11
+ date: 2023-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: factory_bot
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '5.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: retries
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.0.5
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.0.5
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: appraisal
43
57
  requirement: !ruby/object:Gem::Requirement