alchemy_cms 6.1.1 → 6.1.2

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: 143bb006641791929e37a72fd82d200d10084c85e9685934776e54dc61e08f58
4
- data.tar.gz: 2a8a82d5f452822f394ee9af1d55eca46efa4772a269e09583de154addc8be5f
3
+ metadata.gz: f2f303fbee5eb7ba00c41042f4a2c435e345621eae81768d8c66f86dad04d23d
4
+ data.tar.gz: e2ad0dfb05e0412676eb203c0ac7829d4945c8e8db879c8393748bb40089ce19
5
5
  SHA512:
6
- metadata.gz: fd987d8e08a1813c1f6b3ae50904910e1cb8c60c2a1a0ad5906ef9b0cdd3a233c71871e7c3b6b00f10b5caa8f56169c060cd61f03a1f0231b8ae85d7b1ff44b6
7
- data.tar.gz: 9dae2d9dabe3c81da44d17ddfc4ddb8713a328927e07caef81d6c42aba2445a9854262fa12f55f74e3cd11960197ed183bbb898a363c7ff9b3dd5ef175b91743
6
+ metadata.gz: 1ec82e1628873bcfb3f1e16826087289ab1dcefe4bb98598ad320bce329c3f1481dc0df28fdbd0570a3fb79f6325de4a9eee510dd4dc6a981f3cc82565bd908b
7
+ data.tar.gz: 10c17180fbff27a83a2c6f052c200a9723858dea973f547206c9ca094e46b18bdc7130f5914e006acd058296b6783b4adafa47bc2bad87fca29ca6774673a973
@@ -82,6 +82,9 @@ jobs:
82
82
  sudo apt update -qq
83
83
  sudo apt install -qq --fix-missing libmysqlclient-dev -o dir::cache::archives="/home/runner/apt/cache"
84
84
  sudo chown -R runner /home/runner/apt/cache
85
+ - uses: actions/setup-node@v3
86
+ with:
87
+ node-version: 16
85
88
  - name: Restore node modules cache
86
89
  id: yarn-cache
87
90
  uses: actions/cache@v2.1.3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.1.2 (2023-02-27)
4
+
5
+ - [6.1] Fix thumbnail writing for multi-concurrent and multi-db setups [#2434](https://github.com/AlchemyCMS/alchemy_cms/pull/2434) ([tvdeyen](https://github.com/tvdeyen))
6
+
3
7
  ## 6.1.1 (2023-01-23)
4
8
 
5
9
  - Re-introduce deleted methods [#2422](https://github.com/AlchemyCMS/alchemy_cms/pull/2422) ([tvdeyen](https://github.com/tvdeyen))
@@ -3,7 +3,7 @@
3
3
  module Alchemy
4
4
  class Picture < BaseRecord
5
5
  class Url
6
- attr_reader :variant
6
+ attr_reader :variant, :thumb
7
7
 
8
8
  # @param [Alchemy::PictureVariant]
9
9
  #
@@ -31,14 +31,23 @@ module Alchemy
31
31
 
32
32
  def uid
33
33
  signature = PictureThumb::Signature.call(variant)
34
- thumb = variant.picture.thumbs.detect { |t| t.signature == signature }
35
- if thumb
36
- uid = thumb.uid
34
+ if find_thumb_by(signature)
35
+ thumb.uid
37
36
  else
38
37
  uid = PictureThumb::Uid.call(signature, variant)
39
- PictureThumb.generator_class.call(variant, signature, uid)
38
+ ActiveRecord::Base.connected_to(role: ActiveRecord::Base.writing_role) do
39
+ PictureThumb.generator_class.call(variant, signature, uid)
40
+ end
41
+ uid
40
42
  end
41
- uid
43
+ end
44
+
45
+ def find_thumb_by(signature)
46
+ @thumb = if variant.picture.thumbs.loaded?
47
+ variant.picture.thumbs.find { |t| t.signature == signature }
48
+ else
49
+ variant.picture.thumbs.find_by(signature: signature)
50
+ end
42
51
  end
43
52
  end
44
53
  end
@@ -19,11 +19,10 @@ module Alchemy
19
19
 
20
20
  # create the thumb before storing
21
21
  # to prevent db race conditions
22
- thumb = Alchemy::PictureThumb.create!(
23
- picture: variant.picture,
24
- signature: signature,
25
- uid: uid,
26
- )
22
+ @thumb = Alchemy::PictureThumb.create_or_find_by!(signature: signature) do |thumb|
23
+ thumb.picture = variant.picture
24
+ thumb.uid = uid
25
+ end
27
26
  begin
28
27
  # process the image
29
28
  image = variant.image
@@ -32,7 +31,7 @@ module Alchemy
32
31
  rescue RuntimeError => e
33
32
  ErrorTracking.notification_handler.call(e)
34
33
  # destroy the thumb if processing or storing fails
35
- thumb&.destroy
34
+ @thumb&.destroy
36
35
  end
37
36
  end
38
37
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "6.1.1"
4
+ VERSION = "6.1.2"
5
5
 
6
6
  def self.version
7
7
  VERSION
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy_cms/admin",
3
- "version": "6.1.1",
3
+ "version": "6.1.2",
4
4
  "description": "AlchemyCMS",
5
5
  "browser": "package/admin.js",
6
6
  "files": [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.1
4
+ version: 6.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2023-01-23 00:00:00.000000000 Z
16
+ date: 2023-02-27 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: actionmailer
@@ -1538,7 +1538,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1538
1538
  version: '0'
1539
1539
  requirements:
1540
1540
  - ImageMagick (libmagick), v6.6 or greater.
1541
- rubygems_version: 3.3.26
1541
+ rubygems_version: 3.4.6
1542
1542
  signing_key:
1543
1543
  specification_version: 4
1544
1544
  summary: A powerful, userfriendly and flexible CMS for Rails