Skip to content

Commit 374972b

Browse files
authored
Merge pull request #801 from olivier-thatch/olivier-use-new-promises-api
Use concurrent-ruby's new Promises API
2 parents 16f66c9 + 260c1c3 commit 374972b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/sprockets/manifest.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ def find(*args, &block)
120120
return to_enum(__method__, *args) unless block_given?
121121

122122
environment = self.environment.cached
123-
promises = args.flatten.map do |path|
124-
Concurrent::Promise.execute(executor: executor) do
123+
futures = args.flatten.map do |path|
124+
Concurrent::Promises.future_on(executor) do
125125
environment.find_all_linked_assets(path).to_a
126126
end
127127
end
128128

129-
promises.each do |promise|
130-
promise.value!.each(&block)
129+
futures.each do |future|
130+
future.value!.each(&block)
131131
end
132132

133133
nil
@@ -188,15 +188,15 @@ def compile(*args)
188188

189189
filenames << asset.filename
190190

191-
promise = nil
191+
future = nil
192192
exporters_for_asset(asset) do |exporter|
193193
next if exporter.skip?(logger)
194194

195-
if promise.nil?
196-
promise = Concurrent::Promise.new(executor: executor) { exporter.call }
197-
concurrent_exporters << promise.execute
195+
if future.nil?
196+
future = Concurrent::Promises.future_on(executor) { exporter.call }
197+
concurrent_exporters << future
198198
else
199-
concurrent_exporters << promise.then { exporter.call }
199+
concurrent_exporters << future.then { exporter.call }
200200
end
201201
end
202202
end

sprockets.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
1212
s.executables = ["sprockets"]
1313

1414
s.add_dependency "rack", ">= 2.2.4", "< 4"
15-
s.add_dependency "concurrent-ruby", "~> 1.0"
15+
s.add_dependency "concurrent-ruby", "~> 1.1"
1616
s.add_dependency "logger"
1717

1818
s.add_development_dependency "m", ">= 0"

0 commit comments

Comments
 (0)