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

Commit 6d2cebb

Browse files
committed
Mirror services execution is now threaded (with promises)
1 parent 44aab4d commit 6d2cebb

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"
23

34
class ActiveStorage::Service::MirrorService < ActiveStorage::Service
45
attr_reader :services
@@ -26,9 +27,9 @@ def primary_service
2627
end
2728

2829
def perform_across_services(method, *args)
29-
# FIXME: Convert to be threaded
30-
services.collect do |service|
31-
service.public_send method, *args
30+
promises = services.collect do |service|
31+
Concurrent::Promise.execute { service.public_send method, *args }
3232
end
33+
Concurrent::Promise.zip(*promises).value
3334
end
3435
end

0 commit comments

Comments
 (0)