alchemy-dragonfly-s3 6.0.0 → 6.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: 8731b036311b3a669e0644fe5fd9e0301bc981bdc431c102979961aa4db3671e
4
- data.tar.gz: dbddcab7948012fe5d9a12a140fbc203dadac20157b039d74d82d86abb3a7390
3
+ metadata.gz: db1e5c08edd7be1ceba98fb77b3882a31f2bdf49b665eed978cfeff75d87163d
4
+ data.tar.gz: 354c096e7451931b3db43cc949cf73a1c54a13b389a8707af496c17f0cf85157
5
5
  SHA512:
6
- metadata.gz: b0ca6b6a588e561c9c154853d4393e67aeaa7950810347f84d04cf3b61a6e7621c6d228c977d6bd9c3df02c07014e632fabf579392d82687828136b70cef3c75
7
- data.tar.gz: cd8f538c29407ba748d89f6a6b71960b0e9f9812b4924a19151909b42ddad41a3ab14edb43f04b09d546bba3124ce2b4f9c152112f599bcadf04320ce0f52eaa
6
+ metadata.gz: a928b88710af67671e36de32a46a68bb3cfdb59198b41dbdddd8eb5ecf3530c6bef7ce43ce8452b7af0a7dbff259269a1e22a3b70be0aadabd37353262fdc1f8
7
+ data.tar.gz: cdfc3fafb942ec4645f60760521c3c2bb19e8494c42697da1e4f0812fcbb18c1545fd6c7fd781fcfbc42b1449db970e1f04c62718a0837a5811ae071cd7d9027
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v6.0.1
2
+
3
+ - Fix race condition in CreatePictureThumb
4
+
1
5
  ## v6.0.0
2
6
 
3
7
  - Allow Alchemy 6.1
@@ -5,15 +5,13 @@ module Alchemy
5
5
  module S3
6
6
  class CreatePictureThumb
7
7
  def self.call(variant, signature, uid)
8
+ return if !variant.picture.valid?
9
+
8
10
  # create the thumb before uploading
9
11
  # to prevent db race conditions
10
- thumb = nil
11
- if variant.picture.valid?
12
- thumb = Alchemy::PictureThumb.create!(
13
- picture: variant.picture,
14
- signature: signature,
15
- uid: uid,
16
- )
12
+ @thumb = Alchemy::PictureThumb.create_or_find_by!(signature: signature) do |thumb|
13
+ thumb.picture = variant.picture
14
+ thumb.uid = uid
17
15
  end
18
16
  begin
19
17
  # fetch and process the image
@@ -23,7 +21,7 @@ module Alchemy
23
21
  rescue RuntimeError, Excon::Error => e
24
22
  ErrorTracking.notification_handler.call(e)
25
23
  # destroy the thumb if processing or upload fails
26
- thumb&.destroy
24
+ @thumb&.destroy
27
25
  end
28
26
  end
29
27
  end
@@ -3,7 +3,7 @@
3
3
  module Alchemy
4
4
  module Dragonfly
5
5
  module S3
6
- VERSION = "6.0.0"
6
+ VERSION = "6.0.1"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-dragonfly-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-20 00:00:00.000000000 Z
11
+ date: 2023-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alchemy_cms