Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 9661ce6

Browse files
committed
Concurrent deleting in mirror services
1 parent 6d39624 commit 9661ce6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/active_storage/service/mirror_service.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require "active_support/core_ext/module/delegation"
2+
require "concurrent/promise"
23

34
class ActiveStorage::Service::MirrorService < ActiveStorage::Service
45
attr_reader :primary, :mirrors
@@ -32,9 +33,9 @@ def each_service(&block)
3233
end
3334

3435
def perform_across_services(method, *args)
35-
# FIXME: Convert to be threaded
36-
each_service.collect do |service|
37-
service.public_send method, *args
36+
promises = services.collect do |service|
37+
Concurrent::Promise.execute { service.public_send method, *args }
3838
end
39+
Concurrent::Promise.zip(*promises).value
3940
end
4041
end

0 commit comments

Comments
 (0)