activestorage 7.1.3.4 → 7.1.4

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: 10c31beefd192ae50216812e96dd7326c6d301f84f3a9ac4c42cf41369bfbd68
4
- data.tar.gz: b744929e6b8cab0e2c2d2f834b453d538fad962a42b6b52f62ed74cf67fd000b
3
+ metadata.gz: 7090b004185703ae6dc98db17916ed43277cc6e2f36cfe1ed9c80b6ac1571ab0
4
+ data.tar.gz: 1d767b1c2a6c88390ac96ba2e17f6215c30487a87541c03780ba3e3feeb40a34
5
5
  SHA512:
6
- metadata.gz: 93dcf40c82c8a7ecb7308c9e90c42a22816876cfe31c42304369a3979b4a6153a6296a8509d60a9e28bccdd0789f299ef3a734cb0b1b46ca1bd1cbd3c5f411ea
7
- data.tar.gz: 56d0c210295b80a5bd0fa4145901652ddb3d1baede6a22993a294ae4031a378e99c45775e73caefa8890cf6a5bdafb224c215fc12ca33c20491a0cdf1b201b17
6
+ metadata.gz: dde4aa29cd76824dfe0b3b177c20e2ae87d81a8e86d3ad2272ce5507de30a8fbfbb28bab0b81e7bd1845a0f9a0f80c17d5a1dbc951055f7e9c07f88d2bb3d9cf
7
+ data.tar.gz: 1f21e247f8f191da8c81044e194acda189736ff9e4c19939833425f5d0659627988f8a2314cdf193c6f99ff5088d170f3c8b09e8b86459371b3721829ff7e3ae
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## Rails 7.1.4 (August 22, 2024) ##
2
+
3
+ * Fixes race condition for multiple preprocessed video variants.
4
+
5
+ *Justin Searls*
6
+
7
+
1
8
  ## Rails 7.1.3.4 (June 04, 2024) ##
2
9
 
3
10
  * No changes.
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ActiveStorage::PreviewImageJob < ActiveStorage::BaseJob
4
+ queue_as { ActiveStorage.queues[:preview_image] }
5
+
6
+ discard_on ActiveRecord::RecordNotFound, ActiveStorage::UnrepresentableError
7
+ retry_on ActiveStorage::IntegrityError, attempts: 10, wait: :polynomially_longer
8
+
9
+ def perform(blob, variations)
10
+ blob.preview({}).processed
11
+
12
+ variations.each do |transformations|
13
+ blob.preprocessed(transformations)
14
+ end
15
+ end
16
+ end
@@ -132,8 +132,18 @@ class ActiveStorage::Attachment < ActiveStorage::Record
132
132
  end
133
133
 
134
134
  def transform_variants_later
135
- named_variants.each do |_name, named_variant|
136
- blob.preprocessed(named_variant.transformations) if named_variant.preprocessed?(record)
135
+ preprocessed_variations = named_variants.filter_map { |_name, named_variant|
136
+ if named_variant.preprocessed?(record)
137
+ named_variant.transformations
138
+ end
139
+ }
140
+
141
+ if blob.preview_image_needed_before_processing_variants?
142
+ blob.create_preview_image_later(preprocessed_variations)
143
+ else
144
+ preprocessed_variations.each do |transformations|
145
+ blob.preprocessed(transformations)
146
+ end
137
147
  end
138
148
  end
139
149
 
@@ -98,6 +98,14 @@ module ActiveStorage::Blob::Representable
98
98
  variable? || previewable?
99
99
  end
100
100
 
101
+ def preview_image_needed_before_processing_variants? # :nodoc:
102
+ previewable? && !preview_image.attached?
103
+ end
104
+
105
+ def create_preview_image_later(variations) # :nodoc:
106
+ ActiveStorage::PreviewImageJob.perform_later(self, variations) if representable?
107
+ end
108
+
101
109
  def preprocessed(transformations) # :nodoc:
102
110
  ActiveStorage::TransformJob.perform_later(self, transformations) if representable?
103
111
  end
@@ -74,8 +74,10 @@ module ActiveStorage
74
74
  # The system has been designed to having you go through the ActiveStorage::Attached::One
75
75
  # proxy that provides the dynamic proxy to the associations and factory methods, like +attach+.
76
76
  #
77
- # If the +:dependent+ option isn't set, the attachment will be purged
78
- # (i.e. destroyed) whenever the record is destroyed.
77
+ # The +:dependent+ option defaults to +:purge_later+. This means the attachment will be
78
+ # purged (i.e. destroyed) in the background whenever the record is destroyed.
79
+ # If an ActiveJob::Backend queue adapter is not set in the application set it to
80
+ # +purge+ instead.
79
81
  #
80
82
  # If you need the attachment to use a service which differs from the globally configured one,
81
83
  # pass the +:service+ option. For instance:
@@ -162,8 +164,10 @@ module ActiveStorage
162
164
  # The system has been designed to having you go through the ActiveStorage::Attached::Many
163
165
  # proxy that provides the dynamic proxy to the associations and factory methods, like +#attach+.
164
166
  #
165
- # If the +:dependent+ option isn't set, all the attachments will be purged
166
- # (i.e. destroyed) whenever the record is destroyed.
167
+ # The +:dependent+ option defaults to +:purge_later+. This means the attachments will be
168
+ # purged (i.e. destroyed) in the background whenever the record is destroyed.
169
+ # If an ActiveJob::Backend queue adapter is not set in the application set it to
170
+ # +purge+ instead.
167
171
  #
168
172
  # If you need the attachment to use a service which differs from the globally configured one,
169
173
  # pass the +:service+ option. For instance:
@@ -9,8 +9,8 @@ module ActiveStorage
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 1
12
- TINY = 3
13
- PRE = "4"
12
+ TINY = 4
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -35,7 +35,7 @@ require "active_storage/errors"
35
35
  require "marcel"
36
36
 
37
37
  # :markup: markdown
38
- # :include: activestorage/README.md
38
+ # :include: ../README.md
39
39
  module ActiveStorage
40
40
  extend ActiveSupport::Autoload
41
41
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activestorage
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.3.4
4
+ version: 7.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-04 00:00:00.000000000 Z
11
+ date: 2024-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 7.1.3.4
19
+ version: 7.1.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 7.1.3.4
26
+ version: 7.1.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 7.1.3.4
33
+ version: 7.1.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 7.1.3.4
40
+ version: 7.1.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activejob
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 7.1.3.4
47
+ version: 7.1.4
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 7.1.3.4
54
+ version: 7.1.4
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activerecord
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 7.1.3.4
61
+ version: 7.1.4
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 7.1.3.4
68
+ version: 7.1.4
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: marcel
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -116,6 +116,7 @@ files:
116
116
  - app/jobs/active_storage/analyze_job.rb
117
117
  - app/jobs/active_storage/base_job.rb
118
118
  - app/jobs/active_storage/mirror_job.rb
119
+ - app/jobs/active_storage/preview_image_job.rb
119
120
  - app/jobs/active_storage/purge_job.rb
120
121
  - app/jobs/active_storage/transform_job.rb
121
122
  - app/models/active_storage/attachment.rb
@@ -189,10 +190,10 @@ licenses:
189
190
  - MIT
190
191
  metadata:
191
192
  bug_tracker_uri: https://github.com/rails/rails/issues
192
- changelog_uri: https://github.com/rails/rails/blob/v7.1.3.4/activestorage/CHANGELOG.md
193
- documentation_uri: https://api.rubyonrails.org/v7.1.3.4/
193
+ changelog_uri: https://github.com/rails/rails/blob/v7.1.4/activestorage/CHANGELOG.md
194
+ documentation_uri: https://api.rubyonrails.org/v7.1.4/
194
195
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
195
- source_code_uri: https://github.com/rails/rails/tree/v7.1.3.4/activestorage
196
+ source_code_uri: https://github.com/rails/rails/tree/v7.1.4/activestorage
196
197
  rubygems_mfa_required: 'true'
197
198
  post_install_message:
198
199
  rdoc_options: []
@@ -209,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
210
  - !ruby/object:Gem::Version
210
211
  version: '0'
211
212
  requirements: []
212
- rubygems_version: 3.3.27
213
+ rubygems_version: 3.5.11
213
214
  signing_key:
214
215
  specification_version: 4
215
216
  summary: Local and cloud file storage framework.